///////////////////////////////////////////公共//////////////////////////////////////
$(document).on("pageInit", function(e, pageId, $page) {
$.closeModal()
})
//////////////////////////////////////////page_zhifu_other/////////////////
$(document).on("pageInit", "#page_zhifu_other", function(e, pageId, $page) {
	$.showPreloader()
      	            //$('.zhifu_other_daifu span:first').text(sessionStorage.waitfp_cost)
      	            $('form').attr('action',api.orderalipay)
      	            key=my.get_key(my.get_tokenSeed())
      	            var info_zf={
      					waitfp_id:sessionStorage.waitfp_id,
      					order_id:sessionStorage.orderid,
      					payment_channel:1,
      					is_balance:0,
      					is_volume:0,
      					user_id:my.getCookie('id'),
//    					pay_password:0
      				}
      	            //获取支付信息开始
      	            var info_zhifu_get={
      	            	user_id:my.getCookie('id'),
      	            	waitfp_id:sessionStorage.waitfp_id,
      					order_id:sessionStorage.orderid,
      	            }
      	            console.log(info_zhifu_get)
      				info_zhifu_get=my.cryptoASEencrypt(JSON.stringify(info_zhifu_get),key)
      				$.ajax({
      					url:api.userorderpayinfo,
      					type: 'post',
      					async:false,
      					data:{
      						'api_value':info_zhifu_get
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("支付信息获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    $('.zhifu_other_daifu span:first-child').text(config.danwei+data.waitfp_cost)
      								    var daifu=+data.waitfp_cost
      								    var youhui=+data.coupon_value
      								    var dikou=+data.user_balance
      								    console.log('待付:'+daifu)
      								    console.log('优惠:'+youhui)
      								    console.log('抵扣:'+dikou)
      								     //生成支付列表
      								    for(var i=0;i<data.channel_list.length;i++){
      								    	var channel_list='<option value="'+data.channel_list[i].channel_id+'">'+data.channel_list[i].channel_name+'</option>'
      								        $('[name=payment_channel]').append(channel_list)
      								    }
      								    switch(+data.coupon_state){
      								    	case 1:
      								    	info_zf.is_volume=1
      								    	$('.coupon_state').show();
      								    	$('.coupon_value').text(config.danwei+data.coupon_value)
      								    	break;
      								    	case 0:
      								    	info_zf.is_volume=0
      								    	$('.coupon_state').hide();
      								    	break;
      								    }
      								    switch(+data.balance_state){
      								    	case 1:
      								    	info_zf.is_balance=1
      								    	$('.user_balance').text(config.danwei+data.user_balance)
      								    	$('.balance_state').show();
      								    	break;
      								    	case 0:
      								    	info_zf.is_balance=0
      								    	$('.balance_state').hide();
      								    	break;
      								    }
      								    if(youhui>=daifu){
      								    	console.log('优惠大于等于待付')
      								    	$('.user_balance').text(config.danwei+'0')
      								    	$('.zhifu_other_total span:first').text(config.danwei+'0')
      								    	$('[name=payment_channel]').hide()
      								    }else{
      								    	console.log('优惠小于代付')
      								    	if(daifu-youhui>=dikou){
      								    		console.log('全部抵扣')
      								    		$('.user_balance').text(config.danwei+dikou)
      								    		$('.zhifu_other_total span:first').text(config.danwei+(daifu-youhui-dikou).toFixed(2))
      								    	}else{
      								    		console.log('部分抵扣')
      								    		$('.user_balance').text(config.danwei+(daifu-youhui).toFixed(2))
      								    		$('.zhifu_other_total span:first').text(config.danwei+'0')
      								    		$('[name=payment_channel]').hide()
      								    	}
      								    }
      								    $('[name=is_volume]').click(function(){
      								    	console.log(info_zf)
      					                   if($(this).is(':checked')){
      					                      info_zf.is_volume=1;
      					                      //判断开始
      					                      if($('.balance_state').css('display')=='block'&&$('[name=is_balance]').is(':checked')){
      					                      	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.user_balance').text(config.danwei+'0')
      								    	        $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('优惠小于代付')
      								    	       if(daifu-youhui>=dikou){
      								    		     console.log('全部抵扣')
      								    		    $('.user_balance').text(config.danwei+dikou)
      								    		    $('.zhifu_other_total span:first').text(config.danwei+(daifu-youhui-dikou).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								    	        }else{
      								    		    console.log('部分抵扣')
      								    		    $('.user_balance').text(config.danwei+daifu-youhui)
      								    		    $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    		    $('[name=payment_channel]').hide()
      								    	       }
      								            }
      					                     }else if($('.balance_state').css('display')=='block'&&$('[name=is_balance]').is(':checked')==false){
      					                     	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('优惠小于代付')
      								    		    $('.zhifu_other_total span:first').text(config.danwei+(daifu-youhui).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								            }
      					                     }else{
      					                     	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('优惠小于代付')
      								    		    $('.zhifu_other_total span:first').text(config.danwei+(daifu-youhui).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								            }
      					                     }
      					                     //判断结束
      					                   }else{
      					                      info_zf.is_volume=0;
      					                       //判断开始
      					                      if($('.balance_state').css('display')=='block'&&$('[name=is_balance]').is(':checked')){
      					                     
      								    	       if(daifu>=dikou){
      								    		     console.log('全部抵扣')
      								    		    $('.user_balance').text(config.danwei+dikou)
      								    		    $('.zhifu_other_total span:first').text(config.danwei+(daifu-dikou).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								    	        }else{
      								    		     console.log('部分抵扣')
      								    		    $('.user_balance').text(config.danwei+daifu)
      								    		    $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    		   $('[name=payment_channel]').hide()
      								    	       }
      								            
      					                       }else if($('.balance_state').css('display')=='block'&&$('[name=is_balance]').is(':checked')==false){
      								    	         console.log('无优惠，无抵扣')
      								    		     $('.zhifu_other_total span:first').text(config.danwei+daifu.toFixed(2))
      								    		     $('[name=payment_channel]').show()
      								           
      					                        }else{
      					                        	console.log('无优惠，无抵扣')
      								    		     $('.zhifu_other_total span:first').text(config.danwei+daifu.toFixed(2))
      								    		    $('[name=payment_channel]').show()
      					                        }
      					                     //判断结束
      					                   }
      				                    })
      				                    $('[name=is_balance]').click(function(){
      				                    	console.log(info_zf)
      					                   if($(this).is(':checked')){
      					                       info_zf.is_balance=1	
      					                       //判断开始
      					                      if($('.coupon_state').css('display')=='block'&&$('[name=is_volume]').is(':checked')){
      					                      	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.user_balance').text(config.danwei+'0')
      								    	        $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('优惠小于代付')
      								    	       if(daifu-youhui>=dikou){
      								    		     console.log('全部抵扣')
      								    		    $('.user_balance').text(config.danwei+dikou)
      								    		    $('.zhifu_other_total span:first').text(config.danwei+(daifu-youhui-dikou).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								    	        }else{
      								    		    console.log('部分抵扣')
      								    		    $('.user_balance').text(config.danwei+(daifu-youhui).toFixed(2))
      								    		    $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    		   $('[name=payment_channel]').hide()
      								    	       }
      								            }
      					                     }else if($('.coupon_state').css('display')=='block'&&$('[name=is_volume]').is(':checked')==false){
      					                     	if(dikou>daifu){
      								    	         console.log('无优惠，部分抵扣')
      								    	        $('.user_balance').text(config.danwei+daifu)
      								    	        $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('无优惠，全部抵扣')
      								    	         $('.user_balance').text(config.danwei+dikou)
      								    		     $('.zhifu_other_total span:first').text(config.danwei+(daifu-dikou).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								            }
      					                     }else{
      					                     	if(dikou>daifu){
      								    	         console.log('无优惠，部分抵扣')
      								    	        $('.user_balance').text(config.danwei+daifu)
      								    	        $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('无优惠，全部抵扣')
      								    	         $('.user_balance').text(config.danwei+dikou)
      								    		     $('.zhifu_other_total span:first').text(config.danwei+(daifu-dikou).toFixed(2))
      								    		     $('[name=payment_channel]').show()
      								            }
      					                     }
      					                     //判断结束
      					                   }else{
      					                       info_zf.is_balance=0
      					                       //判断开始
      					                      if($('.coupon_state').css('display')=='block'&&$('[name=is_volume]').is(':checked')){
      					                      	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.zhifu_other_total span:first').text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	        
      								    		     console.log('优惠小于待付')
      								    		    $('.zhifu_other_total span:first').text(config.danwei+(daifu-youhui).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								    	       
      								            }
      					                     }else if($('.coupon_state').css('display')=='block'&&$('[name=is_volume]').is(':checked')==false){
      					                     	
      								    	         console.log('无优惠，无抵扣')
      								    		     $('.zhifu_other_total span:first').text(config.danwei+daifu)
      								    		     $('[name=payment_channel]').show()
      								            
      					                     }else{
      					                     	      console.log('无优惠，无抵扣')
      								    		     $('.zhifu_other_total span:first').text(config.danwei+daifu)
      								    		     $('[name=payment_channel]').show()
      					                     	
      					                     }
      					                     //判断结束
      					                   }
      				                    })
      								    //更改支付方式
      								     $('[name=payment_channel]').change(function(){
      	      	                           info_zf.payment_channel=$(this).val()
      	      	                                 console.log(info_zf)
      	                                })
      							}
      					}
      				});
      				
      				//获取支付信息结束
//    				$('[name=is_volume]').click(function(){
//    					if($(this).is(':checked')){
//    					   info_zf.is_volume=1;	
//    					}else{
//    					   info_zf.is_volume=0;
//    					}
//    				})
//    				$('[name=is_balance]').click(function(){
//    					if($(this).is(':checked')){
//    					   info_zf.is_balance=1	
//    					}else{
//    					   info_zf.is_balance=0	
//    					}
//    				})
      				//提交支付开始
      				//验证支付密码字段
      				var info_jymm_back
      				var info_jymm={
      	          		user_id:my.getCookie('id'),
      	          		pay_password:0
      	          	}
      				//写入支付密码
      				$('.zhifu_other_zfmm').change(function(){
      					info_jymm.pay_password=$(this).val()
      					console.log(info_jymm)
      				})
      	            $('.zhifu_other_submit').click(function(){
      	        	//验证交易密码开始
      	          	info_jymm_back=info_jymm
      	          	console.log('info_jymm:'+JSON.stringify(info_jymm))
      	          	info_jymm=my.cryptoASEencrypt(JSON.stringify(info_jymm),key)
      				$.ajax({
      					url:api.paymentpasswordcheck,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_jymm
      					},
      					error:function(){
      						$.hidePreloader()
      						$('.zf-now').removeClass('active_btn')
      					    $.toast("提交失败，请重新提交");
      					    info_jymm=info_jymm_back
      						},
      					success:function(data){
      						info_jymm=info_jymm_back
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							$('.zf-now').removeClass('active_btn')
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      								$('.zhifu_other_submit').addClass('active_btn')
      	      	                    info_zf=my.cryptoASEencrypt(JSON.stringify(info_zf),key)
      	      	                    $('[name=api_value]').val(info_zf)
      	      	                    $('[name=zhifu_other]').submit()
      								
      							}
      					}
      					})
      	      	     
      				
      	        })
      	        //提交支付结束
})
///////////////////////////////page_zhifu_yajin/////////////////////////
$(document).on("pageInit", "#page_zhifu_yajin", function(e, pageId, $page) {
	 $.showPreloader()
      	      key=my.get_key(my.get_tokenSeed())
      	      //获取信用卡信息
      	      var info_xyk={
      					user_id:my.getCookie('id'),
      					type:2
      				}
      				info_xyk=my.cryptoASEencrypt(JSON.stringify(info_xyk),key)
      				$.ajax({
      					url:api.creditcardinfo,
      					type: 'post',
      					async:false,
      					data:{
      						'api_value':info_xyk
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("获取信用卡信息失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    for(var i=0;i<data.length;i++){
      								    	var banklist='<option value="'+data[i].user_bankid+'">'+data[i].bank_name+'信用卡 尾号('+data[i].open_account.substr(-4)+')</option>'
      								    console.log(banklist)
      								     $('.Card-main select').append(banklist)
      								    }
      								   
      								    $('.Card-main select').change(function(){
      								    	info_zf.user_bankid=$(this).val();
      								    })
      							}
      					}
      				})
      				//确认支付字段
      				var info_zf_back
      				var info_zf={
      					order_id:sessionStorage.orderid,
      					type:sessionStorage.zftype,
      					user_id:my.getCookie('id'),
      					user_bankid:0,
      					cvtwo_code:0,
      					valid_date:0
      				}
      				//验证支付密码字段
      				var info_jymm_back
      				var info_jymm={
      	          		user_id:my.getCookie('id'),
      	          		pay_password:0
      	          	}
      				var info_jymm_back_b
      				var info_jymm_b={
      	          		user_id:my.getCookie('id'),
      	          		pay_password:0
      	          	}
      				//修改安全吗
      				$('.zhifyajin-aqm').change(function(){
      					info_zf.cvtwo_code=$(this).val()
      				})
      				//修改验证码
      				$('.zhifyajin-yxq').change(function(){
      					info_zf.valid_date=$(this).val()
      				})
      				//修改交易密码
      				$('.zhifyajin-jymm').change(function(){
      					info_jymm.pay_password=$(this).val()
      				})
      				$('.zhifuyajin-jymmb').change(function(){
      					info_jymm_b.pay_password=$(this).val()
      					console.log(info_jymm_b.pay_password)
      				})
      				
      			  //确认支付
      	           $('.zf-now').click(function(){
      	          	 $.showPreloader()
      	          	 $('.zf-now').addClass('active_btn')
      	          	//验证交易密码开始
      	          	info_jymm_back=info_jymm
      	          	console.log('info_jymm:'+JSON.stringify(info_jymm))
      	          	info_jymm=my.cryptoASEencrypt(JSON.stringify(info_jymm),key)
      				$.ajax({
      					url:api.paymentpasswordcheck,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_jymm
      					},
      					error:function(){
      						$.hidePreloader()
      						$('.zf-now').removeClass('active_btn')
      					    $.toast("交易密码验证失败，请重式");
      					    info_jymm=info_jymm_back
      						},
      					success:function(data){
      						info_jymm=info_jymm_back
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							$('.zf-now').removeClass('active_btn')
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      				//确认提交
      				info_zf_back=info_zf
      				info_zf=my.cryptoASEencrypt(JSON.stringify(info_zf),key)
      				$.ajax({
      					url:api.preauthorizationpay,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_zf
      					},
      					error:function(){
      						$('.zf-now').removeClass('active_btn')
      						$.hidePreloader()
      							$.toast("授权失败，请重式");
      							info_zf=info_zf_back
      						},
      					success:function(data){
      						    info_zf=info_zf_back
      						    $.hidePreloader()
      						if(data.match("err_code")!=null){
      							
      							$('.zf-now').removeClass('active_btn')
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
//    							        data=JSON.parse(data)
//    								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $.alert('授权成功！',function(){
        										//$.router.loadPage("authorizedSuccess.html");
                                            $.router.load(authorizedSuccessUrl,true);
      								        })
      							}
      					      }
      				        })
      				   //确认提交
      						}
      					}
      				})
      	          	//验证交易密码结束
      	        })
      	        //使用新卡点击zf-syjk
      	        $('.zf-syjk').click(function(){
      	        	$('.Card-main').show()
      	        	$('.zf-newCard').hide()
      	        })
      	        $('.zf-syxk').click(function(){
      	        	$('.Card-main').hide()
      	        	$('.zf-newCard').show()
      	        	
      	        })
      	        //选择bank开始
      			        //$(document).on("pageInit",'#page_zhifu_yajin', function() {
      			        $('.sel-bank').click(function(){
      			                $.popup('.popup-IdCard');
      			                $('span[name=yz]').trigger('click')
      			         })
      			         var list=my.getBanks()
      			         console.log(list)
      			         $('.get-car-lista span').click(function(){
		                 $('.get-car-lista span').removeClass('active')
		                 $(this).addClass('active')
		                 var name=$(this).attr('name')
		                 $('.get-car-listb span').remove()
		                 $('.get-car-listb').show()
		                 $('.get-car-listc,.get-car-listd,.get-car-other-box,.get-car-other-btn').hide()
		                 for( k in list){
		           	     if(name.match(list[k].bank_spell.substr(0,1).toLowerCase())){
				         var html="<span id='"+list[k].bankcard_id+"'>"+list[k].bank_name+"</span>"
				            $('.get-car-listb').prepend(html)
		                  }
		                }
		                $('.get-car-listb span').click(function(){ 
		                    $('[name=bankcard_id]').val($(this).attr('id'))
                	        $('.sel-bank').text($(this).text())
                	        $.closeModal('.popup-IdCard')
                                             
	                    })
                      })
      			// })//选择bank结束
      			 //新卡授权开始
      			 $('.get-yz').click(function(){//验证码获取开始
      				    my.countdown('30','.get-yz')
      				    var u_phone={
      					    u_mobile:$('[name=reserved_mobile]').val()
      				    }
      				    u_phone=my.cryptoASEencrypt(JSON.stringify(u_phone),key)
      				    $.ajax({
      					    url:api.sendmobilecode,
      					    type: 'post',
      					    async:true,
      					    data:{
      						        'api_value':u_phone
      					     },
      					    error:function(){
      							$.toast("获取失败，请点击重新获取");
      						 },
      					    success:function(data){
      						   if(data.match("err_code")!=null){	
      							  switch(JSON.parse(data).err_code)
      								 {
      									case 40003:
      									  my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								  }     
      							    }else{
      							            $.toast('验证码发送成功');
      							    }
      					    }
      				     });
      			        })//验证码获取结束
      			 $('.btn-bank').click(function(){//提交开始
      			 	 $.showPreloader()
      			 	 $('.btn-bank').addClass('active_btn')
      			 	//验证交易密码开始
      			 	info_jymm_back_b=info_jymm_b
      			 	console.log('info_jymm_b'+JSON.stringify(info_jymm_b))
      	          	info_jymm_b=my.cryptoASEencrypt(JSON.stringify(info_jymm_b),key)
      				$.ajax({
      					url:api.paymentpasswordcheck,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_jymm_b
      					},
      					error:function(){
      						$.hidePreloader()
      						$('.btn-bank').removeClass('active_btn')
      					    $.toast("验证失败，请重新提交");
      					    info_jymm_b=info_jymm_back_b
      						},
      					success:function(data){
      						info_jymm_b=info_jymm_back_b
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							$('.btn-bank').removeClass('active_btn')
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								var info={
                      	 	'order_id':sessionStorage.orderid,
      					    'type':sessionStorage.zftype,
      					    'user_id':my.getCookie('id'),
      					    'carder_name':$('[name=carder_name]').val(),
      						'open_account':$('[name=open_account]').val(),
      						'bankcard_id':$('[name=bankcard_id]').val(),
      						'valid_data':$('[name=valid_data]').val(),
      						'cvtwo_code':$('[name=cvtwo_code]').val(),
      						'reserved_mobile':$('[name=reserved_mobile]').val(),
      						'm_mobilecode':$('[name=m_mobilecode]').val(),
      				    }
      				   console.log(info)
      				    info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				    $.ajax({
      					    url:api.newpreauthorizationpay,
      					    type: 'post',
      					    async:true,
      					    data:{
      						        'api_value':info
      					     },
      					    error:function(){
      					    	$.hidePreloader()
      					    	 $('.btn-bank').removeClass('active_btn')
      							$.toast("授权失败，请重试");
      						 },
      					    success:function(data){
      					    	$.hidePreloader()
      						   if(data.match("err_code")!=null){
      						   	$('.btn-bank').removeClass('active_btn')
      							  switch(JSON.parse(data).err_code)
      								 {
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								  }     
      							    }else{
//    							            data=JSON.parse(data)
//    								        data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								        	$.alert('授权成功！',function(){
        										//$.router.loadPage("authorizedSuccess.html");
                                                    $.router.load(authorizedSuccessUrl,true);
      								        })
      							    }
      					    }
      				     });
      								
      							}
      						 }
      				   })
      			 	//验证交易密码结束
                      	 
      				    
                      	
                      })//提交结束
      			 //新卡授权结束
})
/////////////////////////////////////////page_zhifu_Park////////////////////
$(document).on("pageInit", "#page_zhifu_Park", function(e, pageId, $page) {
	                $.showPreloader()
      	            //$('.zhifu_other_daifu span:first').text(sessionStorage.waitfp_cost)
      	            $('form').attr('action',api.parkingorderalipay)
      	            var key=my.get_key(my.get_tokenSeed())
      	            var info_zf={
      					waitfp_id:sessionStorage.park_waitfp_id,
      					order_id:sessionStorage.park_parking_id,
      					payment_channel:1,
      					is_balance:0,
      					is_volume:0,
      					user_id:my.getCookie('id'),
//    					pay_password:0
      				}
      	            console.log(info_zf)
      	            //获取支付信息开始
      	            var info_zhifu_get={
      	            	user_id:my.getCookie('id'),
      	            	waitfp_id:sessionStorage.park_waitfp_id,
      					order_id:sessionStorage.park_parking_id,
      	            }
      	            console.log(info_zhifu_get)
      				info_zhifu_get=my.cryptoASEencrypt(JSON.stringify(info_zhifu_get),key)
      				$.ajax({
      					url:api.userorderpayinfo,
      					type: 'post',
      					async:false,
      					data:{
      						'api_value':info_zhifu_get
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("支付信息获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    $('.zhifu_other_daifu span').eq(0).text(config.danwei+data.waitfp_cost)
      								    var daifu=+data.waitfp_cost
      								    var youhui=+data.coupon_value
      								    var dikou=+data.user_balance
      								    console.log('待付:'+daifu)
      								    console.log('优惠:'+youhui)
      								    console.log('抵扣:'+dikou)
      								     //生成支付列表
      								    for(var i=0;i<data.channel_list.length;i++){
      								    	var channel_list='<option value="'+data.channel_list[i].channel_id+'">'+data.channel_list[i].channel_name+'</option>'
      								        $('[name=payment_channel]').append(channel_list)
      								    }
      								    switch(+data.coupon_state){
      								    	case 1:
      								    	info_zf.is_volume=1
      								    	$('.coupon_state').show();
      								    	$('.coupon_value').text(config.danwei+data.coupon_value)
      								    	break;
      								    	case 0:
      								    	info_zf.is_volume=0
      								    	$('.coupon_state').hide();
      								    	break;
      								    }
      								    switch(+data.balance_state){
      								    	case 1:
      								    	info_zf.is_balance=1
      								    	$('.user_balance').text(config.danwei+data.user_balance)
      								    	$('.balance_state').show();
      								    	break;
      								    	case 0:
      								    	info_zf.is_balance=0
      								    	$('.balance_state').hide();
      								    	break;
      								    }
      								    if(youhui>=daifu){
      								    	console.log('优惠大于等于待付')
      								    	$('.user_balance').text(config.danwei+'0')
      								    	$('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    	$('[name=payment_channel]').hide()
      								    }else{
      								    	console.log('优惠小于代付')
      								    	if(daifu-youhui>=dikou){
      								    		console.log('全部抵扣')
      								    		$('.user_balance').text(config.danwei+dikou)
      								    		$('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-youhui-dikou).toFixed(2))
      								    	}else{
      								    		console.log('部分抵扣')
      								    		$('.user_balance').text(config.danwei+(daifu-youhui).toFixed(2))
      								    		$('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    		$('[name=payment_channel]').hide()
      								    	}
      								    }
      								    $('[name=is_volume]').click(function(){
      								    	console.log(info_zf)
      					                   if($(this).is(':checked')){
      					                      info_zf.is_volume=1;
      					                      //判断开始
      					                      if($('.balance_state').css('display')=='block'&&$('[name=is_balance]').is(':checked')){
      					                      	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.user_balance').text(config.danwei+'0')
      								    	        $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('优惠小于代付')
      								    	       if(daifu-youhui>=dikou){
      								    		     console.log('全部抵扣')
      								    		    $('.user_balance').text(config.danwei+dikou)
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-youhui-dikou).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								    	        }else{
      								    		    console.log('部分抵扣')
      								    		    $('.user_balance').text(config.danwei+daifu-youhui)
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    		    $('[name=payment_channel]').hide()
      								    	       }
      								            }
      					                     }else if($('.balance_state').css('display')=='block'&&$('[name=is_balance]').is(':checked')==false){
      					                     	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('优惠小于代付')
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-youhui).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								            }
      					                     }else{
      					                     	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('优惠小于代付')
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-youhui).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								            }
      					                     }
      					                     //判断结束
      					                   }else{
      					                      info_zf.is_volume=0;
      					                       //判断开始
      					                      if($('.balance_state').css('display')=='block'&&$('[name=is_balance]').is(':checked')){
      					                     
      								    	       if(daifu>=dikou){
      								    		     console.log('全部抵扣')
      								    		    $('.user_balance').text(config.danwei+dikou)
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-dikou).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								    	        }else{
      								    		     console.log('部分抵扣')
      								    		    $('.user_balance').text(config.danwei+daifu)
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    		   $('[name=payment_channel]').hide()
      								    	       }
      								            
      					                       }else if($('.balance_state').css('display')=='block'&&$('[name=is_balance]').is(':checked')==false){
      								    	         console.log('无优惠，无抵扣')
      								    		     $('.zhifu_other_total span').eq(0).text(config.danwei+daifu.toFixed(2))
      								    		     $('[name=payment_channel]').show()
      								           
      					                        }else{
      					                        	console.log('无优惠，无抵扣')
      								    		     $('.zhifu_other_total span').eq(0).text(config.danwei+daifu.toFixed(2))
      								    		    $('[name=payment_channel]').show()
      					                        }
      					                     //判断结束
      					                   }
      				                    })
      				                    $('[name=is_balance]').click(function(){
      				                    	console.log(info_zf)
      					                   if($(this).is(':checked')){
      					                       info_zf.is_balance=1	
      					                       //判断开始
      					                      if($('.coupon_state').css('display')=='block'&&$('[name=is_volume]').is(':checked')){
      					                      	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.user_balance').text(config.danwei+'0')
      								    	        $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('优惠小于代付')
      								    	       if(daifu-youhui>=dikou){
      								    		     console.log('全部抵扣')
      								    		    $('.user_balance').text(config.danwei+dikou)
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-youhui-dikou).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								    	        }else{
      								    		    console.log('部分抵扣')
      								    		    $('.user_balance').text(config.danwei+(daifu-youhui).toFixed(2))
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    		   $('[name=payment_channel]').hide()
      								    	       }
      								            }
      					                     }else if($('.coupon_state').css('display')=='block'&&$('[name=is_volume]').is(':checked')==false){
      					                     	if(dikou>daifu){
      								    	         console.log('无优惠，部分抵扣')
      								    	        $('.user_balance').text(config.danwei+daifu)
      								    	        $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('无优惠，全部抵扣')
      								    	         $('.user_balance').text(config.danwei+dikou)
      								    		     $('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-dikou).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								            }
      					                     }else{
      					                     	if(dikou>daifu){
      								    	         console.log('无优惠，部分抵扣')
      								    	        $('.user_balance').text(config.danwei+daifu)
      								    	        $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	         console.log('无优惠，全部抵扣')
      								    	         $('.user_balance').text(config.danwei+dikou)
      								    		     $('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-dikou).toFixed(2))
      								    		     $('[name=payment_channel]').show()
      								            }
      					                     }
      					                     //判断结束
      					                   }else{
      					                       info_zf.is_balance=0
      					                       //判断开始
      					                      if($('.coupon_state').css('display')=='block'&&$('[name=is_volume]').is(':checked')){
      					                      	if(youhui>=daifu){
      								    	        console.log('优惠大于等于待付')
      								    	        $('.zhifu_other_total span').eq(0).text(config.danwei+'0')
      								    	        $('[name=payment_channel]').hide()
      								            }else{
      								    	        
      								    		     console.log('优惠小于待付')
      								    		    $('.zhifu_other_total span').eq(0).text(config.danwei+(daifu-youhui).toFixed(2))
      								    		    $('[name=payment_channel]').show()
      								    	       
      								            }
      					                     }else if($('.coupon_state').css('display')=='block'&&$('[name=is_volume]').is(':checked')==false){
      					                     	
      								    	         console.log('无优惠，无抵扣')
      								    		     $('.zhifu_other_total span').eq(0).text(config.danwei+daifu)
      								    		     $('[name=payment_channel]').show()
      								            
      					                     }else{
      					                     	      console.log('无优惠，无抵扣')
      								    		     $('.zhifu_other_total span').eq(0).text(config.danwei+daifu)
      								    		     $('[name=payment_channel]').show()
      					                     	
      					                     }
      					                     //判断结束
      					                   }
      				                    })
      								    //更改支付方式
      								     $('[name=payment_channel]').change(function(){
      	      	                           info_zf.payment_channel=$(this).val()
      	      	                                 console.log(info_zf)
      	                                })
      							}
      					}
      				});
      				
      				//获取支付信息结束
      				//提交支付开始
      				//验证支付密码字段
      				var info_jymm_back
      				var info_jymm={
      	          		user_id:my.getCookie('id'),
      	          		pay_password:0
      	          	}
      				//写入支付密码
      				$('.zhifu_other_zfmm').change(function(){
      					info_jymm.pay_password=$(this).val()
      					console.log(info_jymm)
      				})
      	            $('.zhifu_other_submit').click(function(){
      	        	//验证交易密码开始
      	          	info_jymm_back=info_jymm
      	          	console.log('info_jymm:'+JSON.stringify(info_jymm))
      	          	info_jymm=my.cryptoASEencrypt(JSON.stringify(info_jymm),key)
      				$.ajax({
      					url:api.paymentpasswordcheck,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_jymm
      					},
      					error:function(){
      						$.hidePreloader()
      						$('.zf-now').removeClass('active_btn')
      					    $.toast("提交失败，请重新提交");
      					    info_jymm=info_jymm_back
      						},
      					success:function(data){
      						info_jymm=info_jymm_back
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							$('.zf-now').removeClass('active_btn')
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      								$('.zhifu_other_submit').addClass('active_btn')
      	      	                    info_zf=my.cryptoASEencrypt(JSON.stringify(info_zf),key)
      	      	                    $('[name=api_value]').val(info_zf)
      	      	                    $('[name=zhifu_other]').submit()
      								
      							}
      					}
      					})
      	      	     
      				
      	        })
});
///////////////////////////////////////////PAY//////////////////////////////////////



//////////////////////////////////////////HOME/////////////////////////////////
//////////////////////////////////////////////////////page_home//////////////////////////////////
$(document).on("pageInit", "#page_home", function(e, pageId, $page) {
	              $.showPreloader()
      	          key=my.get_key(my.getCookie('token'))
      	          var info={'u_userid':my.getCookie('id')}
    				  info=JSON.stringify(info)
                      info=my.cryptoASEencrypt(info,key)
      	              $.ajax({
      						type:"post",
      						url:api.useraccountinfo,
      						data:{
      							'api_value':info
      						},
      						async:true,
      						error:function(XMLHttpRequest){
      							$.alert("请求失败，请刷新重试");
      						},
      						complete:function(){
      							setTimeout(function(){
      								 $.hidePreloader();
      							},100)
      						},
      						success:function(data){
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      									   
      								}
      							}else{
      								    
      								    data=JSON.parse(data)
                                        data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $('.balance').text(config.danwei+data.balance)
      								    $('.total_revenue').text(config.danwei+data.total_revenue)
      								    if(data.withdrawal_state==0){
      								    	$('.withdrawal_state').attr('href','')
      								    }
      								    if(data.user_name==''){
      								         $('.user_name label').text('待认证用户')
      								    }else{
      								    	 $('.user_name label').text(data.user_name)
      								    }
      								    if(data.identity_state==1){
      								    	$('.identity_state img').attr('src','/h5car/img/icon/ok.png')
      								    	$('.identity_state a').attr('href',showOwnerUrl)
      								    	$('.identity_state span:first-child label').text(data.identity_statedoc)
      								    }else if(data.identity_state==0){
      								    	$('.identity_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.identity_state span:first-child label').text(data.identity_statedoc)
      								    }else if(data.identity_state==2){
      								    	$('.identity_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.identity_state span:first-child label').text(data.identity_statedoc)
      								    	$('.identity_state a').attr('href','')
      								    }else if(data.identity_state==3){
      								    	$('.identity_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.identity_state span:first-child label').text(data.identity_statedoc)
      								    }
      								    if(data.carmanage_state==1){
      								    	$('.carmanage_state img').attr('src','/h5car/img/icon/ok.png')
      								    	$('.carmanage_state span:first-child label').text(data.carmanage_doc.doc_one+" : "+data.carmanage_doc.count_one)
      								    	$('.carmanage_state span').eq(1).text(data.carmanage_doc.doc_two+" : "+data.carmanage_doc.count_two)
      								    	$('.carmanage_state span').eq(2).text(data.carmanage_doc.doc_thr+" : "+data.carmanage_doc.count_thr)
      								    }else{
      								    	$('.carmanage_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.carmanage_state span:first-child label').text(data.carmanage_doc)
      								    }
      								    if(data.credit_state==1){
      								    	$('.credit_state img').attr('src','/h5car/img/icon/ok.png')
      								    }
      								    $('.credit_state label').text('信用卡'+data.credit_doc)
      								    $('.cashcard_state label').text('提现卡'+data.cashcard_doc)
      								    if(data.setpassword_state==1){
      								    	$('.setpassword_state img').attr('src','/h5car/img/icon/ok.png')
      								    }else if(data.setpassword_state==0){
      								    	$('.setpassword_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.setpassword_state span:first-child label').text(data.setpassword_doc)
      								    }
      								    if(data.coupons_state==1){
      								    	$('.coupons_state span:first-child').text(data.coupons_doc)
      								    }
      								    $('.about_our span:first-child').text(data.about_our.telephone)
      							   }
      							 }
      						  });
      			    //退出登录开始
      			    $('.tc').click(function(){
      			    	my.setCookie('token','',-1)
                        my.setCookie('id','',-1)
      			    	$.router.loadPage("parkIndex.html");
      			    })
      				$('.get-car-hold').click(function(){
      					$('.get-cash').hide();
      					$(this).hide()
      				})
      		        //下拉刷新start
      		        $(".pull-to-refresh-content-home").on('refresh',function() {
      		    	  var  key=my.get_key(my.getCookie('token'))
      		    	  var info={'u_userid':my.getCookie('id')}
    				  info=JSON.stringify(info)
                      info=my.cryptoASEencrypt(info,key).toString()
      	              $.ajax({
      						type:"post",
      						url:api.useraccountinfo,
      						data:{
      							'api_value':info
      						},
      						async:true,
      						error:function(){
      							$.pullToRefreshDone('.pull-to-refresh-content');
      							$.toast("请求失败，请刷新重试");
      						},
      						success:function(data){
      							if(data.match("err_code")!=null){
      								$.pullToRefreshDone('.pull-to-refresh-content');
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      									   
      								}
                                         
      							}else{
      								    
      								    data=JSON.parse(data)
                                        data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $('.balance').text(config.danwei+data.balance)
      								    $('.total_revenue').text(config.danwei+data.total_revenue)
      								    if(data.withdrawal_state==0){
      								    	$('.withdrawal_state').attr('href','')
      								    }
      								    if(data.user_name==''){
      								         $('.user_name label').text('待认证用户')
      								    }else{
      								    	 $('.user_name label').text(data.user_name)
      								    }
      								    if(data.identity_state==1){
      								    	$('.identity_state img').attr('src','/h5car/img/icon/ok.png')
      								    	$('.identity_state a').attr('href','showOwner.html')
      								    	$('.identity_state span:first-child label').text(data.identity_statedoc)
      								    }else if(data.identity_state==0){
      								    	$('.identity_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.identity_state span:first-child label').text(data.identity_statedoc)
      								    }else if(data.identity_state==2){
      								    	$('.identity_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.identity_state span:first-child label').text(data.identity_statedoc)
      								    	$('.identity_state a').attr('href','')
      								    }else if(data.identity_state==3){
      								    	$('.identity_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.identity_state span:first-child label').text(data.identity_statedoc)
      								    }
      								    if(data.carmanage_state==1){
      								    	$('.carmanage_state img').attr('src','/h5car/img/icon/ok.png')
      								    	$('.carmanage_state span:first-child label').text(data.carmanage_doc.doc_one+" : "+data.carmanage_doc.count_one)
      								    	$('.carmanage_state span').eq(1).text(data.carmanage_doc.doc_two+" : "+data.carmanage_doc.count_two)
      								    	$('.carmanage_state span').eq(2).text(data.carmanage_doc.doc_thr+" : "+data.carmanage_doc.count_thr)
      								    }else{
      								    	$('.carmanage_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.carmanage_state span:first-child label').text(data.carmanage_doc)
      								    }
      								    if(data.credit_state==1){
      								    	$('.credit_state img').attr('src','/h5car/img/icon/ok.png')
      								    }
      								    $('.credit_state label').text('信用卡'+data.credit_doc)
      								    $('.cashcard_state label').text('提现卡'+data.cashcard_doc)
      								    if(data.setpassword_state==1){
      								    	$('.setpassword_state img').attr('src','/h5car/img/icon/ok.png')
      								    }else if(data.setpassword_state==0){
      								    	$('.setpassword_state img').attr('src','/h5car/img/icon/no.png')
      								    	$('.setpassword_state span:first-child label').text(data.setpassword_doc)
      								    }
      								    if(data.coupons_state==1){
      								    	$('.coupons_state span:first-child').text(data.coupons_doc)
      								    }
      								    $('.about_our span:first-child').text(data.about_our.telephone)
      								    $.pullToRefreshDone('.pull-to-refresh-content');
      							   }
      							 }
      						  });
      		    })//下拉刷新end
});
//////////////////////////////////////////////////////page_withdrawalState//////////////////////////////////
$(document).on("pageInit", "#page_withdrawalState", function(e, pageId, $page) {
	 $.showIndicator();
            key=my.get_key(my.getCookie('token'));
            var info={'user_id':my.getCookie('id')};
            info=JSON.stringify(info);
            info=my.cryptoASEencrypt(info,key);
            //console.log(info);return;
            $.ajax({
                type:"post",
                url:api.getbankcard,
                data:{
                    'api_value':info
                },
                async:true,
                error:function(XMLHttpRequest){
                    console.log(XMLHttpRequest);
                     $.hideIndicator();
                    $.alert("请求失败，请刷新重试");
                },
                success:function(data){
                    if(data.match("err_code")!=null){
                        $.hideIndicator();
                        //console.log(JSON.parse(data).err_code);
                        switch(JSON.parse(data).err_code)
                        {
                            case 40003:
                                my.tokenExpire();
                                break;
                            case 50091:
                                $.alert(JSON.parse(data).err_msg);
                                $.router.load(checkBankCardUrl,true);
                            default:
                                $.alert(JSON.parse(data).err_msg);

                        }
                    }else{
                        data=JSON.parse(data);
                        data=JSON.parse(my.cryptoASEdencrypt(data.data,key));
                        //console.log(data);
                        $(".balancea_account").text(data.balancea_ccount);
                        $(".balancea_account_hidden").val(data.balancea_ccount);
                        $(".band_name").html(data.bank_name+'('+data.open_account+')');
                        $(".user_bankid").val(data.user_bankid);
                        $(".b_name").val(data.bank_name);
                        $(".b_cardid").val(data.open_account);
                        $.hideIndicator();

                    }
                }
            });

            $(".cancel").click(function(){
               // $.router.loadPage("home.html");
                $.router.load(homeUrl,true);
            });

            $(".subWithdrawal").click(function(){
                $.alert('您确认要申请提现么？',function(){
                    var withdrawalmoney = $(".withdrawalmoney").val();
                    var withdrawalpass = $(".withdrawalpass").val();
                    var balancea_account = $(".balancea_account_hidden").val();
                    if(balancea_account==0){
                        $.toast('账户余额为0不能提现');
                        return false;
                    }
                    if($.trim(withdrawalmoney)==''){
                        $.toast('请输入提现金额');
                        return false;
                    }
//                if(withdrawalmoney > balancea_account){
//                    $.toast('提现金额大于账户余额');
//                    return false;
//                }
                    if($.trim(withdrawalpass)==''){
                        $.toast('请输入支付密码');
                        return false;
                    }
                    var info={
                        'user_id':my.getCookie('id'),
                        'user_cash':$.trim(withdrawalmoney),
                        'user_paymentpass':$.trim(withdrawalpass),
                        'user_bankname': $(".b_name").val(),
                        'user_carcode': $(".b_cardid").val()
                    };
                    info=JSON.stringify(info);
                    info=my.cryptoASEencrypt(info,key).toString();
                    $.ajax({
                        type:"post",
                        url:api.withdrawals,
                        data:{
                            'api_value':info
                        },
                        async:true,
                        error:function(XMLHttpRequest){
                            console.log(XMLHttpRequest);
                            $.hideIndicator();
                            $.toast("请求失败，请刷新重试");
                        },
                        success:function(data){
                            if(data.match("err_code")!=null){
                                $.hideIndicator();
                                //console.log(JSON.parse(data).err_code);
                                switch(JSON.parse(data).err_code)
                                {
                                    case 40003:
                                        my.tokenExpire();
                                        break;
                                    case 50100:
                                        $.toast(JSON.parse(data).err_msg);
                                    case 50101:
                                        $.toast(JSON.parse(data).err_msg);
                                    case 50102:
                                        $.toast(JSON.parse(data).err_msg);
                                    case 50405:
                                        $.toast(JSON.parse(data).err_msg);
                                    case 50608:
                                        $.toast(JSON.parse(data).err_msg);
                                    default:
                                        $.toast(JSON.parse(data).err_msg);

                                }
                            }else{
                                data=JSON.parse(data);
                                data=JSON.parse(my.cryptoASEdencrypt(data.data,key));
                                console.log(data);
                                if(data.result_state==1){
                                    $.toast('提交成功');
                                   // $.router.loadPage("home.html");
                                    $.router.load(homeUrl,true);
                                }else{
                                    $.toast('提交失败');
                                }
                                $.hideIndicator();

                            }
                        }
                    });
                });

            });
});
/////////////////////////////////////page_tradeDetails/////////////////
$(document).on("pageInit", "#page_tradeDetails", function(e, pageId, $page) {
	 var now=new Date();
                y=now.getFullYear();
                m=now.getMonth()+1;
                d=now.getDay()+4;
                m=m<10?"0"+m:m;
                d=d<10?"0"+d:d;
                var endtime = y+"-"+m+"-"+d;

                var endnow=new Date();
                yy=endnow.getFullYear();
                mm=endnow.getMonth();
                dd=endnow.getDay()+3;
                mm=mm<10?"0"+mm:mm;
                dd=dd<10?"0"+dd:dd;
                var starttime = yy+"-"+mm+"-"+dd;
                $("#rang-time-start").calendar({});
      			$("#rang-time-end").calendar({});
                $(".time_start").val(starttime);
                $(".time_end").val(endtime);
               
               var  key=my.get_key(my.getCookie('token'));
                  var getUserAccountDetailList=my.getUserAccountDetailList(my.getCookie('id'),starttime,endtime,1,10,key);
                 //console.log(getUserAccountDetailList);return;
                  var loading = false;
                  var RentalOrderType=1;
                  var pageNow=1;
                if(getUserAccountDetailList!=''){
                    for(i=0;i<getUserAccountDetailList.length;i++){
                        var list="<li style='ackground-color: #f3f3f3;margin-bottom: 0.2rem;padding: 0.3rem;text-align: center;'>" +
                                "<div><span>"+getUserAccountDetailList[i].account_remark+"</span><span>"+types(getUserAccountDetailList[i].account_type)+"</span><span>"+typescash(getUserAccountDetailList[i].account_type,getUserAccountDetailList[i].account_cash)+"</span><div class='clear'></div></div>" +
                        "<div><span style='display: block;width: 6rem;float: left'>"+substringDate(getUserAccountDetailList[i].account_date)+"</span><span></span><span style='display:block;float: right;margin-right:0.3rem;width:2.5rem'>"+getUserAccountDetailList[i].account_balancea+"</span><div class='clear'></div></div></li>";

                        $('.useraccout').append(list)
                    }
                    if(getUserAccountDetailList.length<10){
                        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
                    }else{
                        $.attachInfiniteScroll($('.page-current'));
                        $('.infinite-scroll-preloader').show();
                        $('.infiniteOver').hide()
                    }
                }else{
                    $.detachInfiniteScroll($('.infinite-scroll'));
                    $('.infinite-scroll-preloader').hide();
                    $('.infiniteOver').show()
                }


                //收入支出类型转换
                function types(t){
                    if(t==1){
                        return "支出";
                    }
                    if(t==2){
                        return "收入";
                    }
                }
                //钱正负转化
                function typescash(type,cash){
                    if(type==1){
                        return "-"+cash;
                    }
                    if(type==2){
                        return "+"+cash;
                    }
                }
                //日期截取
                function substringDate(str){
                   return str.substring(0,16);
                }
//////////////////////////////////////////查询日期结束//////////////////////////////////////////////////////////////////
  //
                //检索
                $(".searchAccount").click(function(){
                    $(".useraccout").empty();
                    var startdate = $(".time_start").val();
                    var enddate = $(".time_end").val();
                    if(startdate=='' || enddate==''){
                        $.alert('请输入开始或结束时间');
                        return false;
                    }
                    startdate = startdate+' 00:00:00';
                    enddate = enddate+' 23:59:59';
                    var key=my.get_key(my.getCookie('token'));
                    var getUserAccountDetailList=my.getUserAccountDetailList(my.getCookie('id'),startdate,enddate,1,10,key);
                    //console.log(getUserAccountDetailList);return;
                    setTimeout(function(){

                    if(getUserAccountDetailList!=''){
                        for(i=0;i<getUserAccountDetailList.length;i++){
                            var list="<li style='ackground-color: #f3f3f3;margin-bottom: 0.2rem;padding: 0.3rem;text-align: center;'>" +
                                    "<div><span>"+getUserAccountDetailList[i].account_remark+"</span><span>"+types(getUserAccountDetailList[i].account_type)+"</span><span>"+typescash(getUserAccountDetailList[i].account_type,getUserAccountDetailList[i].account_cash)+"</span><div class='clear'></div></div>" +
                                    "<div><span style='display: block;width: 6rem;float: left'>"+substringDate(getUserAccountDetailList[i].account_date)+"</span><span></span><span style='display:block;float: right;margin-right:0.3rem;width:2.5rem'>"+getUserAccountDetailList[i].account_balancea+"</span><div class='clear'></div></div></li>";

                            $('.useraccout').append(list);
                        }
                        if(getUserAccountDetailList.length<10){
                            $.detachInfiniteScroll($('.infinite-scroll'));
                            $('.infinite-scroll-preloader').hide();
                            $('.infiniteOver').show();
                        }else{
                            $.attachInfiniteScroll($('.page-current'));
                            $('.infinite-scroll-preloader').show();
                            $('.infiniteOver').hide();
                        }
                    }else{
                        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show();
                    }
                 },1000);
                });


                //下拉分页
                //无限加载
                $(document).on("infinite", ".infinite-scroll-UserAccout", function() {
                    // 如果正在加载，则退出
                    if (loading) return;
                    pageNow=Math.ceil($('.useraccout li').length/9);
                   //console.log('pageNow:'+pageNow);
                    loading = true;
                    setTimeout(function() {
                        loading = false;
                        var startdate = $(".time_start").val();
                        var enddate = $(".time_end").val();
                        startdate = startdate+' 00:00:00';
                        enddate = enddate+' 23:59:59';
                        var key=my.get_key(my.getCookie('token'));
                        var getUserAccountDetailList=my.getUserAccountDetailList(my.getCookie('id'),startdate,enddate,pageNow,10,key);
                        if(getUserAccountDetailList!=''){
                            if(pageNow==1){
                                $('.useraccout').empty();
                            }
                           //console.log('载入条数:'+getUserAccountDetailList.length);
                            for(i=0;i<getUserAccountDetailList.length;i++){
                                var list="<li style='ackground-color: #f3f3f3;margin-bottom: 0.2rem;padding: 0.3rem;text-align: center;'>" +
                                        "<div><span>"+getUserAccountDetailList[i].account_remark+"</span><span>"+types(getUserAccountDetailList[i].account_type)+"</span><span>"+typescash(getUserAccountDetailList[i].account_type,getUserAccountDetailList[i].account_cash)+"</span><div class='clear'></div></div>" +
                                        "<div><span style='display: block;width: 6rem;float: left'>"+substringDate(getUserAccountDetailList[i].account_date)+"</span><span></span><span style='display:block;float: right;margin-right:0.3rem;width:2.5rem'>"+getUserAccountDetailList[i].account_balancea+"</span><div class='clear'></div></div></li>";

                                $('.useraccout').append(list);
                            }
                            if(getUserAccountDetailList.length<10){
                                $.detachInfiniteScroll($('.infinite-scroll'));
                                $('.infinite-scroll-preloader').hide();
                                $('.infiniteOver').show();
                            }
                        }else{
                            $.detachInfiniteScroll($('.infinite-scroll'));
                            $('.infinite-scroll-preloader').hide();
                            $('.infiniteOver').show();
                        }
                    }, 1000);
                });
                //无限加载结束
});
//////////////////////////////////////////page_showOwner/////////////////
$(document).on("pageInit", "#page_showOwner", function(e, pageId, $page) {
	              $.showPreloader()
      			  var key=my.get_key(my.getCookie('token'))
      			  var info_owner={
      					'u_userid':my.getCookie('id'),
      					}
    					info_owner=JSON.stringify(info_owner)
                        info_owner=my.cryptoASEencrypt(info_owner,key).toString()
      				    $.ajax({
      						type:"post",
      						url:api.useridentityinfo,
      						data:{
      							'api_value':info_owner
      						},
      						async:true,			
      						error:function(){
      							$.hidePreloader()
      							$.toast("请重试..");
      						},
      						success:function(data){
      							$.hidePreloader()
      							    if(data.match("err_code")!=null){
      								  switch(JSON.parse(data).err_code)
      								  {
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									case 50051:
      									   $.alert(JSON.parse(data).err_msg,function(){
      									   	$.router.loadPage("home.html");
      									   });
      									   
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								  }
                                         
      							    }else{
      							    	    //sessionStorage.identity_info=data
      								        data=JSON.parse(data)
                                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
                                            $('[name=u_name]').val(data[0].userfullname)
                                            $('[name=idcard]').val(data[0].useridnumber)
                                            $('[name=dri_license]').val(data[0].driverlicense)
      								        var idcard_img='<div class="swiper-slide"><img src="'+config.url+data[0].idcard_img+'">'
      							    	        $(idcard_img).appendTo('.swiper-wrapper')
      							    	    var idcard_secondimg='<div class="swiper-slide"><img src="'+config.url+data[0].idcard_secondimg+'">'
      							    	        $(idcard_secondimg).appendTo('.swiper-wrapper')
      							    	    var license_firstimg='<div class="swiper-slide"><img src="'+config.url+data[0].license_firstimg+'">'
      							    	        $(license_firstimg).appendTo('.swiper-wrapper')
      							    	    var license_secendimg='<div class="swiper-slide"><img src="'+config.url+data[0].license_secendimg+'">'
      							    	        $(license_secendimg).appendTo('.swiper-wrapper')
      							    	       
      							            var showOwnerSwiper = new Swiper('.swiper-container',{
                                                       pagination : '.swiper-pagination',
                                                       paginationElement : 'li',
                                                })
      							    }
      						},
      				});
});
////////////////////////////////page_checkOwner//////////////
$(document).on("pageInit", "#page_checkOwner", function(e, pageId, $page) {
	            var key=my.get_key(my.getCookie('token'))
      			//上传照片
      			$('.img-sfz-z').click(function(){
      				var list={"id":".img-sfz-z","text":"身份证正面"}
      			        list=JSON.stringify(list)
      				    ad.native_get_photo(list)
      			})
      			$('.img-sfz-f').click(function(){
      				 var list={"id":".img-sfz-f","text":"身份证反面"}
      			        list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-jsz-z').click(function(){
      				 var list={"id":".img-jsz-z","text":"驾驶证正面"}
      			        list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-jsz-f').click(function(){
      				 var list={"id":".img-jsz-f","text":"驾驶证反面"}
      			        list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('#zc').click(function(){
      				$('#zc').addClass('active_btn')
//    				for(i=0;i<$('.checkOwner-list :text').length;i++){
//    					if($('.checkOwner-list :text').eq(i).val()==''){
//    						$.toast('请填写完整')
//    						$(':text').eq(i).focus()
//    						return false
//    					}
//    				}
//    				if($('.img-sfz-z').attr('name')=='0'){$.toast('请上传身份证正面'); return false}
//    				if($('.img-sfz-f').attr('name')=='0'){$.toast('请上传身份证反面'); return false}
//    				if($('.img-jsz-z').attr('name')=='0'){$.toast('请上传驾驶证正面'); return false}
//    				if($('.img-jsz-f').attr('name')=='0'){$.toast('请上传驾驶证反面'); return false}
      				$.showPreloader()
      				var info_checkOwner={
      					//'u_userid':sessionStorage.id,
      					'u_userid':my.getCookie('id'),
      					'u_name':encodeURIComponent($('[name=u_name]').val()),
      					'u_idcard':encodeURIComponent($('[name=idcard]').val()),
      					'dri_license':encodeURIComponent($('[name=dri_license]').val()),
      					'idc_first_img':$('.img-sfz-z').attr('name'),
      					'idc_secend_img':$('.img-sfz-f').attr('name'),
      					'lic_first_img':$('.img-jsz-z').attr('name'),
      					'lic_secend_img':$('.img-jsz-f').attr('name'),
      					}
    					info_checkOwner=JSON.stringify(info_checkOwner)
                        info_checkOwner=my.cryptoASEencrypt(info_checkOwner,key).toString()
      				    $.ajax({
      						type:"post",
      						url:api.useridentity,
      						data:{
      							'api_value':info_checkOwner
      						},
      						async:true,			
      						error:function(){
      							$('#zc').removeClass('active_btn')
      							$.hidePreloader()
      							$.toast("提交失败，请重试..");
      						},
      						success:function(data){
      							$.hidePreloader()
      							console.log('ok')
      							$('#zc').removeClass('active_btn')
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									case 50051:
      									   $.alert(JSON.parse(data).err_msg,function(){
      									      $.router.loadPage("home.html");
      									   });
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								}
      							}else{
        								$.alert('提交成功，等待审核',function(){
        								   //  $.router.loadPage("home.html");
                                            $.router.load(homeUrl,true);
        								})
      							        
      							}
      						},
      				});
      						
      			})
});
///////////////////////////////page_carManger//////////////////////////
$(document).on("pageInit", "#page_carManger", function(e, pageId, $page) {
	            $.showPreloader()
      	        var key=my.get_key(my.getCookie('token'))
      	        var info_carManger={
      						//'u_userid':sessionStorage.id,
      						'u_userid':my.getCookie('id'),
      					}
    				info_carManger=JSON.stringify(info_carManger)
                    info_carManger=my.cryptoASEencrypt(info_carManger,key)
      	            $.ajax({
      						type:"post",
      						url:api.usercarlist,
      						data:{
      							'api_value':info_carManger
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$.alert("请求失败，请刷新重试");
      						},
      						success:function(data){
      							$.hidePreloader()
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      									   
      								}
                                         
      							}
      							else{
      								      data=JSON.parse(data)
                                          data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    //循环输出车辆
      								    $('.carManger-list ul').empty()
      								    for(i=0;i<data.length;i++){
      								     var none='display:none;';
      								     var none_in='display:none'
      								     var none_edit='display:none'
      								     var state_doc='...正在认证'
      								     if(data[i].auditresult_state==1){
      								     	none='display:block;'
      								     	none_in='display:inline-block;'
      								     	state_doc='认证通过'
      								     }
      								     if(data[i].auditresult_state==2){
      								     	none_edit='display:block'
      								     	state_doc='认证失败：'+data[i].resultreason
      								     }
      								      var list='<li name="'+ data[i].usercar_id +'"><div class="car-edit"><div class="carManger-list-top"><div><span><img src="/h5car/img/icon/qcc.png" ></span><p class="brand_chinese_name">'
      					                                      + data[i].brand_chinese_name +'</p><div class="clear"></div></div><div class="car_plate">'
      					                                      + data[i].car_plate +'</div><div class="auditresult_state"><img src="/h5car/img/icon/ok.png" style="width:15px;margin: 0 5px -2px 0;'+ none_in +'">'
      					                                      + state_doc +'</div></div></div><div class="carManger-list-btn" style="'+ none +'"><div><a href='+carRentalUrl+' class="external"><img src="/h5car/img/icon/rll.png">出租</a></div><div class="clear"></div></div><div class="carManger-list-btn carManger-list-btn-edit" style="'+ none_edit +'"><div class="r-check"><img src="/h5car/img/icon/bj.png">重新认证</div><div class="clear"></div></div></li>'
      								      $('.carManger-list ul').append(list)	
      								    }
      							          }
      							        //汽车编辑
      							        $('.car-edit').click(function(){
      							        	sessionStorage.car_id=$(this).closest('li').attr('name')
                                                //$.router.loadPage('carEdit.html',true)
                                            $.router.load(carEditUrl,true);
      							        })
      							        $('.carManger-list-btn-edit').click(function(){
      							        	sessionStorage.car_carid=$(this).closest('li').attr('name')
      							        	//$.router.loadPage('RecheckCar.html')
                                            $.router.load(RecheckCarUrl,true);
      							        })
      			                    },		            
      		                 });
      		    //下拉刷新start
      		    $(document).on('refresh', '.pull-to-refresh-content-carMangerCarlist',function() {
      		    	var info_carManger_refresh={
      						//'u_userid':sessionStorage.id,
      						'u_userid':my.getCookie('id'),
      					}
    				info_carManger_refresh=JSON.stringify(info_carManger_refresh)
                    info_carManger_refresh=my.cryptoASEencrypt(info_carManger_refresh,key)
      		    	$.ajax({
      						type:"post",
      						url:api.usercarlist,
      						data:{
      							'api_value':info_carManger_refresh
      						},
      						async:true,
      						error:function(){
      							$.pullToRefreshDone('.pull-to-refresh-content');
      							$.toast("请求失败，请刷新重试");
      						},
      						success:function(data){
      							if(data.match("err_code")!=null){
      								$.pullToRefreshDone('.pull-to-refresh-content');
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      									   
      								}
                                         
      							}else{
      								    //sessionStorage.carManger_list=my.cryptoASEdencrypt(data,key)
      								   // data=JSON.parse(my.cryptoASEdencrypt(data,key))
      								      data=JSON.parse(data)
                                          data=JSON.parse(my.cryptoASEdencrypt(data.data,key))

      								    //循环输出车辆
      								    $('.CM-list').text('')
      								    for(i=0;i<data.length;i++){
      								     var none='display:none;';
      								     var none_in='display:none'
      								     var none_edit='display:none'
      								     var state_doc='...正在认证'
      								     if(data[i].auditresult_state==1){
      								     	none='display:block;'
      								     	none_in='display:inline-block;'
      								     	state_doc='认证通过'
      								     }
      								     if(data[i].auditresult_state==2){
      								     	none_edit='display:block'
      								     	state_doc='认证失败：'+data[i].resultreason
      								     }
      								      var list='<li name="'+ data[i].usercar_id +'"><div class="car-edit"><div class="carManger-list-top"><div><span><img src="/h5car/img/icon/qcc.png" ></span><p class="brand_chinese_name">'
      					                                      + data[i].brand_chinese_name +'</p><div class="clear"></div></div><div class="car_plate">'
      					                                      + data[i].car_plate +'</div><div class="auditresult_state"><img src="/h5car/img/icon/ok.png" style="width:15px;margin: 0 5px -2px 0;'+ none_in +'">'
      					                                      + state_doc +'</div></div></div><div class="carManger-list-btn" style="'+ none +'"><div><img src="/h5car/img/icon/rll.png">出租</div><div class="clear"></div></div><div class="carManger-list-btn carManger-list-btn-edit" style="'+ none_edit +'"><div class="r-check open-popup"><img src="/h5car/img/icon/bj.png">重新认证</div><div class="clear"></div></div></li>'
      								      $('.carManger-list ul').append(list)	
      								    }
      								    $.pullToRefreshDone('.pull-to-refresh-content');
      							          }
      							        //汽车编辑
      							        $('.car-edit').click(function(){
      							        	sessionStorage.car_id=$(this).closest('li').attr('name')
      							        	$.router.loadPage('carEdit.html',true)
      							        })
      							        $('.carManger-list-btn-edit').click(function(){
      							        	sessionStorage.car_carid=$(this).closest('li').attr('name')
      							        	$.router.loadPage('RecheckCar.html')
      							        })
      			                    },		            
      		                 });
                     });//下拉刷新end
});
////////////////////////////////carEdit/////////////////////////////////
$(document).on("pageInit", "#page_carEdit", function(e, pageId, $page) {
	               $.showPreloader()
      	    	   var key=my.get_key(my.getCookie('token'))
                   //获取照片
                   var info_carEdit={
      						     //'u_userid':sessionStorage.id,
      						     'cars_id':sessionStorage.car_id,
      					                }
    					info_carEdit=JSON.stringify(info_carEdit)
                        info_carEdit=my.cryptoASEencrypt(info_carEdit,key)
                        $.ajax({
      					url:api.getcarsinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_carEdit
      					},
      					error:function(){
      							$.toast("请求失败，请刷新重试");
      						},
//    					complete:function(){
//    						setTimeout(function(){
//    							$.hidePreloader()
//    						},10)
//    					},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      								  data=JSON.parse(data)
                                      data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								if(data['carimg'].length==0){
      									$('.swiper-slide-hold').css('display','block')
      								    $('.swiper-slide-hold img').attr('src',config.url_car+'/models/20160608102036852147.jpg')
      								}else{
      							      for(i=0;i<data['carimg'].length;i++){
      							    	var src='<div class="swiper-slide"><img id="'+data['carimg'][i].image_id+'" src="'+config.url+data['carimg'][i].image_bigurl+'">'
      							    	$(src).appendTo('.swiper-wrapper')
      							       }
      							    }
      							    var mySwiper = new Swiper('.swiper-container',{
                                                       pagination : '.swiper-pagination',
                                                       paginationElement : 'li',
                                                })
      							    $('.cars_name').text(data['cars_name'])
      							    $('.car_platee').text(data['car_plate'])
      							    if(data['auditresult_state']==1){
      							    	$('.carEdit-list').css('display','block')
      							    	$('.auditresult_state').html('<img src="/h5car/img/icon/ok.png" style="width:15px;margin: 0 5px -2px 0;display:inline-block;">认证通过</div>')
      							    }else if(data['auditresult_state']==2){
      							    	$('.auditresult_state').html('<img src="/h5car/img/icon/no.png" style="width:15px;margin: 0 5px -2px 0;display:inline-block;">认证失败</div>')
      							    }
      							    $('.vehicle_name').text(data['vehicle_name'])
      							    $('.identification').text(data['identification'])
      							    $('.vehicle_registetime').text(data['vehicle_registetime'].substr(0,11))
      							    $('.vehicle_endtime').text(data['vehicle_endtime'].substr(0,11))
      							    $('.vehicle_number').text(data['vehicle_number'])
      							    $('.insurance_no').text(data['insurance_no'])
      							    $('.insurance_date').text(data['insurance_date'].substr(0,11))
      							    $('.business_innum').text(data['business_innum'])
      							    $('.business_date').text(data['business_date'].substr(0,11))
      							}
      					}
      				});
      				//删除图片
      				$('.del-img').click(function(){
      					                      $.confirm('确认要删除么', function () {
      					                      	$.showPreloader()
      					                      	var info_carEdit_delImg={
      						                          // 'u_userid':sessionStorage.id,
      						                           'image_id':$('.swiper-slide-next img').attr('id'),
      						                           'cars_id':sessionStorage.car_id,
      					                              }
    					                            info_carEdit_delImg=JSON.stringify(info_carEdit_delImg)
                                                    info_carEdit_delImg=my.cryptoASEencrypt(info_carEdit_delImg,key)
      					                            $.ajax({
      						                        type:"post",
      						                        url:api.userdelcarimg,
      						                        data:{
      							                       'api_value':info_carEdit_delImg,
      						                           },
      						                        async:true,
      						                        error:function(){
      							                                    $.hidePreloader()
      							                                    $.alert("删除失败，请重试");
      							                                    //$.router.reloadPage()
      						                                      },
      						                        success:function(data){
      						                        	$.hidePreloader()
      							                        if(data.match("err_code")!=null){
      								                     switch(JSON.parse(data).err_code)
      								                     {
      									                   case 40003:
      									                    my.tokenExpire()
      									                   break;
      									                  default:
      									                    $.alert(JSON.parse(data).err_msg);
      									                    //$.router.reloadPage()
      								                     }
                                         
      							                        }else{
        								                 	$.alert('删除成功')
        								                    $.router.reloadPage();
                                                          }
      					                         	},
      					                           });
                                               });
      				                        })
      				//删除汽车
      				$('.delete-car').click(function(){
      					                   var cars_id=sessionStorage.car_id
      					                      $.confirm('确认要删除么', function () {
      					                      	$.showPreloader()
      					                      	var info_carEdit_delCar={
      						                          // 'u_userid':sessionStorage.id,
      						                           'u_userid':my.getCookie('id'),
      						                           'cars_id':cars_id,
      					                              }
    					                            info_carEdit_delCar=JSON.stringify(info_carEdit_delCar)
                                                    info_carEdit_delCar=my.cryptoASEencrypt(info_carEdit_delCar,key)
      					                            $.ajax({
      						                        type:"post",
      						                        url:api.usercardelete,
      						                        data:{
      							                       'api_value':info_carEdit_delCar,
      						                           },
      						                        async:true,
      						                        error:function(){
      							                                    $.hidePreloader()
      							                                    $.toast("删除失败，请重试");
      							                                    //$.router.reloadPage()
      						                                      },
      						                        success:function(data){
      						                        	$.hidePreloader()
      							                        if(data.match("err_code")!=null){
      								                     switch(JSON.parse(data).err_code)
      								                     {
      									                   case 40003:
      									                    my.tokenExpire()
      									                   break;
      									                  default:
      									                    $.toast(JSON.parse(data).err_msg);
      								                     }
                                         
      							                        }else{
        								                 	$.alert('删除成功',function(){
        								                 		//$.router.load("carManger.html",true)
                                                                $.router.load(carMangerUrl,true)
        								                 		//$('[name='+cars_id+']').css('display','none')
        								                 	})
                                                          }
      					                         	},
      					                           });
                                               });
      				                        })
      							      
                 //添加照片
                 $('.carEdit-img-tj').click(function(){
                 	 var list={"id":".carEdit-img-tj","text":"no"}
      			         list=JSON.stringify(list)
      			         ad.native_get_photo(list)
                 	
                })
});
/////////////////////////////////////page_cardManger//////////////////////////////////
$(document).on("pageInit", "#page_cardManger", function(e, pageId, $page) {
	                $.showPreloader()
      	    	    var key=my.get_key(my.getCookie('token'))
      		        var info_Card={//获取银行卡信息开始
      					    'u_userid':my.getCookie('id'),
      				    }
      				    info_Card=my.cryptoASEencrypt(JSON.stringify(info_Card),key)
      				    $.ajax({
      					    url:api.userbankcardlist,
      					    type: 'post',
      					    async:true,
      					    data:{
      						        'api_value':info_Card
      					     },
      					    error:function(){
      					    	$.hidePreloader()
      							$.alert("获取银行卡信息失败，请刷新");
      						 },
      					    success:function(data){
      					    	$.hidePreloader()
      						   if(data.match("err_code")!=null){	
      							  switch(JSON.parse(data).err_code)
      								 {
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								  }     
      							    }else{
      							            data=JSON.parse(data)
      								        data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								        for(k in data){
      								        	if(data[k].card_type==1){
      								        	 var str= '<div class="IdCard"><img src="'+config.domain+data[k].bank_logo+'"><div class="IdCard-right"><div>'+data[k].bank_name+'</div><div>'+data[k].open_account+'</div></div><div class="clear"></div></div><div class="del-btn del-card" id="'+data[k].user_bankid+'"><img src="/h5car/img/icon/sq.png">删除</div>'
      								              $('.Card-main').prepend(str)
      								             }else{
      								             	var str= '<div class="IdCard"><img src="'+config.domain+data[k].bank_logo+'"><div class="IdCard-right"><div>'+data[k].bank_name+'信用卡</div><div>'+data[k].open_account+'</div></div><div class="clear"></div></div><div class="del-btn del-card" id="'+data[k].user_bankid+'"><img src="/h5car/img/icon/sq.png">删除</div>'
      								              $('.Card-main').prepend(str)
      								             }
      								        }
      								        if(data[0].is_debitcard==1){
      								        	$('.txk').hide()
      								        }else{
      								        	$('.txk').show()
      								        }
      								        $('.del-card').click(function(){//删除银行卡
      								        	var id=$(this).attr('id')
      								        	$.confirm('确定要删除么?', function () {
      								        		$.showPreloader()
      								        		var info={//获取银行卡信息开始
      					    'user_bankid':id,
      				     }
      				     info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				     $.ajax({
      					    url:api.userbankcarddelte,
      					    type: 'post',
      					    async:true,
      					    data:{
      						        'api_value':info
      					     },
      					    error:function(){
      					    	$.hidePreloader()
      							$.alert("删除失败，请刷新");
      						 },
      					    success:function(data){
      					    	$.hidePreloader()
      						   if(data.match("err_code")!=null){	
      							  switch(JSON.parse(data).err_code)
      								 {
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								  }     
      							   }else{
      								     $.alert('删除成功');
      								      $.router.reloadPage()
      								       
      							    }
      					    }
      				     });
         
                                                });
      				     	
      				 })//删除银行卡结束
      								       
      							    }
      					    }
      				     });//获取银行卡信息结束
});
//////////////////////////////page_checkIdCard/////////////////
$(document).on("pageInit", "#page_checkIdCard", function(e, pageId, $page) {
	                    key=my.get_key(my.getCookie('token'))
      	    			$('.get-yz').click(function(){//验证码获取开始
      				    my.countdown('30','.get-yz')
      				    var u_phone={
      					    u_mobile:encodeURIComponent($('[name=reserved_mobile]').val())
      				    }
      				    u_phone=my.cryptoASEencrypt(JSON.stringify(u_phone),key)
      				    $.ajax({
      					    url:api.sendmobilecode,
      					    type: 'post',
      					    async:true,
      					    data:{
      						        'api_value':u_phone
      					     },
      					    error:function(){
      							$.toast("获取失败，请点击重新获取");
      						 },
      					    success:function(data){
      						   if(data.match("err_code")!=null){	
      							  switch(JSON.parse(data).err_code)
      								 {
      									case 40003:
      									  my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								  }     
      							    }else{
      							            $.toast('验证码发送成功');
      							    }
      					    }
      				     });
      			        })//验证码获取结束
      			        //选择bank开始
      			        $('.sel-bank').click(function(){
      			                $.popup('.popup-IdCard');
      			            $('span[name=yz]').trigger('click')
      			        })
      			         var list=my.getBanks()
      			         $('.get-car-lista span').click(function(){
		                 $('.get-car-lista span').removeClass('active')
		                 $(this).addClass('active')
		                 var name=$(this).attr('name')
		                 $('.get-car-listb span').remove()
		                 $('.get-car-listb').show()
		                 $('.get-car-listc,.get-car-listd,.get-car-other-box,.get-car-other-btn').hide()
		                 for( k in list){
		           	     if(name.match(list[k].bank_spell.substr(0,1).toLowerCase())){
				         var html="<span id='"+list[k].bankcard_id+"'>"+list[k].bank_name+"</span>"
				            $('.get-car-listb').prepend(html)
		                  }
		                }
		                $('.get-car-listb span').click(function(){ 
		                    $('[name=bankcard_id]').val($(this).attr('id'))
                	        $('.sel-bank').text($(this).text())
                	        $.closeModal('.popup-IdCard')
                                             
	                   })
      			         })//选择bank结束
                      $('.btn-bank').click(function(){//提交开始
                      	$.showPreloader()
                      	 var info={
      					    'u_userid':my.getCookie('id'),
      					    'card_type':2,
      					    'carder_name':encodeURIComponent($('[name=carder_name]').val()),
      						'open_account':encodeURIComponent($('[name=open_account]').val()),
      						'bankcard_id':encodeURIComponent($('[name=bankcard_id]').val()),
      						'valid_data':encodeURIComponent($('[name=valid_data]').val()),
      						'cvtwo_code':encodeURIComponent($('[name=cvtwo_code]').val()),
      						'reserved_mobile':encodeURIComponent($('[name=reserved_mobile]').val()),
      						'm_mobilecode':encodeURIComponent($('[name=m_mobilecode]').val()),
      				    }
      				    info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				    $.ajax({
      					    url:api.useraddbankcard,
      					    type: 'post',
      					    async:true,
      					    data:{
      						        'api_value':info
      					     },
      					    error:function(){
      					    	$.hidePreloader()
      							$.toast("提交失败，请点击重新获取");
      						 },
      					    success:function(data){
      					    	$.hidePreloader()
      						   if(data.match("err_code")!=null){	
      							  switch(JSON.parse(data).err_code)
      								 {
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								  }     
      							    }else{
      							            data=JSON.parse(data)
      								        data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								        if(data.result_state=='ok'){
      								        	$.alert('绑定成功！',function(){
        										//$.router.loadPage("cardManger.html");
                                                    $.router.load(cardMangerUrl,true);
        									})
      								        }
      							    }
      					    }
      				     });
                      	
                      })//提交结束
});
////////////////////////////////////page_editLoginPass/////////////////////////////
$(document).on("pageInit", "#page_editLoginPass", function(e, pageId, $page) {
	            var key=my.get_key(my.getCookie('token'))
                //验证码获取
      			$('.get-yz').click(function(){//
      				my.countdown('30','.get-yz')
      				var u_phone={
      					u_mobile:my.getCookie('phone')
      				}
      				u_phone=my.cryptoASEencrypt(JSON.stringify(u_phone),key).toString()
      				$.ajax({
      					url:api.sendmobilecode,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':u_phone
      					},
      					error:function(){
      							$.toast("获取失败，请点击重新获取");
      						},
      					success:function(data){
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.setCookie('token',false,-1);
      									   my.setCookie('id',false,-1);
      									   $.alert("获取失败，请重新获取",function(){
      					                   $.router.reloadPage()
      				                       });
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      							$.toast('验证码发送成功');
      							}
      					}
      				});
      			})
      			//验证两次密码输入
      			$('.login-list-qr').blur(function(){
      					if($(this).val()!=$('.login-list-mm').val()){
      						$(this).val('')
      						$.toast('两次输入密码不相同')
      					}
      					
      				}
      			)
      			//提交
      			$('.changPass-btn-submit').click(function(){
      				if($('.login-list input').eq(0).val().length<6||$('.login-list input').eq(1).val().length<6){
      					$.toast('输入有误，请重新输入')
      					$('.login-list input').eq(0).val('').focus()
      					return;
      				}
      				if($('.login-list-qr').val()!=$('.login-list-mm').val()){
      						$(this).val('')
      						$.toast('两次输入密码不相同')
      					return;
      					}
      				$.showPreloader()
      				$(this).css({'color':'#fff','backgroundColor':'#5926BF'})
      				var info={
      						//'u_userid':sessionStorage.id,
      						//'u_userid':my.getCookie('id'),
      						'u_mobile':my.getCookie('phone'),
      						'u_password':encodeURIComponent($('[name=u_password]').val()),
      						'm_mobilecode':encodeURIComponent($('[name=m_mobilecode]').val()),

      					}
    					info=JSON.stringify(info)
                        info=my.cryptoASEencrypt(info,key).toString()
      				$.ajax({
      						type:"post",
      						url:api.userupdatepassword,
      						data:{
      							'api_value':info
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$.toast("修改失败，请重试..");
      						},
      						success:function(data){
      							$.hidePreloader()
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      									   $.router.reloadPage()
      								}
                                         
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    if(data.result_state!='ok'){
      								    	  $.alert("修改失败，请您重试",function(){
      								    	  	$.router.reloadPage()
      								    	  });
      								    	  
      								    }else{
      								        $.alert("修改成功",function(){
      								           //$.router.back("changePass.html");
                                                $.router.back(changePassUrl);
                                            });
      							            
      								    }
      								    
      								   
      							}
      						},
      				});
      						
      			})
});
//////////////////////////////////page_editPayPass/////////////
$(document).on("pageInit", "#page_editPayPass", function(e, pageId, $page) {
	var key=my.get_key(my.getCookie('token'))
      			//表单选中效果切换
//    			$('.login-list input').focus(function(){
//    				$(this).css('color','#000')
//    			})
//    			$('.login-list input').blur(function(){
//    				$(this).css('color','#ccc')
//    			})
                //获取验证码
                //验证码获取
      			$('.get-yz').click(function(){//
      				my.countdown('30','.get-yz')
      				var u_phone={
      					u_mobile:my.getCookie('phone')
      				}
      				u_phone=my.cryptoASEencrypt(JSON.stringify(u_phone),key).toString()
      				$.ajax({
      					url:api.sendmobilecode,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':u_phone
      					},
      					error:function(){
      							$.toast("获取失败，请点击重新获取");
      						},
      					success:function(data){
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.setCookie('token',false,-1);
      									   my.setCookie('id',false,-1);
      									   $.alert("获取失败，请重新获取",function(){
      					                   $.router.reloadPage()
      				                       });
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      							$.toast('验证码发送成功');
      							}
      					}
      				});
      			})
      			//验证两次密码输入
      			$('.login-list-qr').blur(function(){
      					if($(this).val()!=$('.login-list-mm').val()){
      						$(this).val('')
      						$.toast('两次输入密码不相同')
      					}
      					
      				}
      			)
      			//提交
      			$('.changPass-btn-submit').click(function(){
      				if($('.login-list input').eq(0).val().length<6||$('.login-list input').eq(1).val().length<6){
      					$.toast('输入有误，请重新输入')
      					$('.login-list input').eq(0).val('').focus()
      					return ;
      				}
      				if($('.login-list-qr').val()!=$('.login-list-mm').val()){
      						$(this).val('')
      						$.toast('两次输入密码不相同')
      					return ;
      					}
      				$.showPreloader()
      				$(this).css({'color':'#fff','backgroundColor':'#5926BF'})
      				var info={
      						//'u_userid':sessionStorage.id,
      						'u_mobile':my.getCookie('phone'),
      						'pay_password':encodeURIComponent($('[name=pay_password]').val()),
      						'm_mobilecode':encodeURIComponent($('[name=m_mobilecode]').val()),

      					}
    					info=JSON.stringify(info)
                        info=my.cryptoASEencrypt(info,key).toString()
      				$.ajax({
      						type:"post",
      						url:api.setpaypassword,
      						data:{
      							'api_value':info
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$.toast("修改失败，请重试..");
      						},
      						success:function(data){
      							$.hidePreloader()
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      									   $.router.reloadPage()
      								}
                                         
      							}else{  
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    if(data.result_state!='ok'){
      								    	  $.alert("修改失败，请您重试",function(){
      								    	  $.router.reloadPage()
      								    	  });
      								    	  
      								    }else{
      								        $.alert("修改成功",function(){
      								        	//sessionStorage.home=''
      								           //$.router.bakc("changePass.html");
                                                $.router.bakc(changePassUrl);
                                            });
      							            
      								    }
      								    
      								   
      							}
      						},
      				});
      						
      			})
});
///////////////////////////////////page_youhui//////////////////////////////
$(document).on("pageInit", "#page_youhui", function(e, pageId, $page) {
	 var key=my.get_key(my.getCookie('token'))
      			     var info_yh={
      					'user_id':my.getCookie('id'),
      					}
    					info_yh=JSON.stringify(info_yh)
                        info_yh=my.cryptoASEencrypt(info_yh,key)
      				    $.ajax({
      						type:"post",
      						url:api.getusercoupon,
      						data:{
      							'api_value':info_yh
      						},
      						async:true,			
      						error:function(){
      							$.toast("获取失败");
      						},
      						success:function(data){
      							    if(data.match("err_code")!=null){
      								  switch(JSON.parse(data).err_code)
      								  {
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									case 50051:
      									   $.alert(JSON.parse(data).err_msg,function(){
      									   //	$.router.loadPage("home.html");
                                               $.router.load(homeUrl,true);
      									   });
      									   
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								  }
                                         
      							    }else{
      							    	 data=JSON.parse(data)
                                         data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
                                         console.log(data)
      	    	                    for(v in data){
      	    	   	                  var list='<li><div class="carR-ok-b"><span>'
           	    	                  +data[v].coupon_name+'</span><span>抵用券名</span></div><div class="carR-ok-b"><span>'
           	    	                  +data[v].coupon_value+'</span><span>抵用面额</span></div><div class="carR-ok-b"><span>'
           	    	                  +data[v].begin_date+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
           	    	                  +data[v].end_date+'</span><span>结束时间</span></div></li>'           	    	
           	                          $('.youhui-order-list').append(list)
           	                         }
      	    	                     }
      							    }
      				})
});
////////////////////////////////page_RecheckCar///////////////////////
$(document).on("pageInit", "#page_RecheckCar", function(e, pageId, $page) {
	 key=my.get_key(my.getCookie('token'))
      	    	 var list=my.getCars()
      	    	 console.log(list)
      			//注册登陆点击效果
      			$('.login-list-b a').click(function(){
      				$(this).css({'color':'#fff','backgroundColor':'#5926BF'})
      			})
      			//选择品牌
      			$('.sel-car').click(function(){
      			   $.popup('.popup');
      			   $('span[name=abc]').trigger('click')
      			})
      		     var other_name=''
      		     var other_id=''
      		    $('.get-car-other').click(function(){
               	  $('.get-car-listb,.get-car-listc,.get-car-listd').hide()
               	  $('.get-car-other-box,.get-car-other-btn').show()
               	  other_name='[name='+$(this).attr('name')+'_name'
               	  other_id='[name='+$(this).attr('name')+'_id'
                })
                $('.get-car-other-btn').click(function(){
                	$('.sel-car').text($('.get-car-other-box').val())
                	$(other_name).val($('.get-car-other-box').val())
                	$(other_id).val(0)
                	$.closeModal('.popup')
                })
	             $('.get-car-lista span').click(function(){
		           $('.get-car-lista span').removeClass('active')
		           $(this).addClass('active')
		           var name=$(this).attr('name')
		           $('.get-car-listb span').not('.get-car-other').remove()
		           $('.get-car-listb').show()
		           $('.get-car-listc,.get-car-listd,.get-car-other-box,.get-car-other-btn').hide()
		           for( k in list){
		           	if(name.match(list[k].benglish_name.substr(0,1))){
				         var html="<span id='"+k+"'>"+list[k].brand_name+"</span>"
				       $('.get-car-listb').prepend(html)
		             }
		           }
		           $('.get-car-listb span').not('.get-car-other').click(function(){
		           	      $('[name=brand_id]').val($(this).attr('id'))
		 	              $('.get-car-listb span').removeClass('active')
		                  $(this).addClass('active')
		                  $('.get-car-listc span').not('.get-car-other').remove()
		                  $('.get-car-listc').show()
		                  $('.get-car-listd span').not('.get-car-other').remove()
		                  $('.get-car-listd').hide()
		                  var j=$(this).attr('id')
		                   for(k in list[j].xi){
				               var html="<span id='"+j+"' name='"+k+"' >"+list[j].xi[k].cars_name+"</span>"
				                   $('.get-car-listc').prepend(html)
		                   }
		                   $('.get-car-listc span').not('.get-car-other').click(function(){
		                   	                    $('[name=cars_id]').val($(this).attr('name'))
		                   	                     $('.get-car-listc span').removeClass('active')
		                                         $(this).addClass('active')
		                                         $('.get-car-listd span').not('.get-car-other').remove()
		                                         $('.get-car-listd').show()
		                                         var j=$(this).attr('id')
		                                         var w=$(this).attr('name')
		                                         for(k in list[j].xi[w].chexing){
				                                       var html="<span id='"+k+"'>"+list[j].xi[w].chexing[k].models_name+"</span>"
				                                           $('.get-car-listd').prepend(html)
		                                            }
		                                          $('.get-car-listd span').not('.get-car-other').click(function(){
		                                          	$('[name=models_id]').val($(this).attr('id'))
                	                                $('.sel-car').text($(this).text())
                	                                $.closeModal('.popup')
                                                  })
	                    })
	                })
               })
      			//上传图片
      			$('.img-xsz-z').click(function(){
      				 var list={"id":".img-xsz-z","text":"行驶证正面"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-xsz-f').click(function(){
      				 var list={"id":".img-xsz-f","text":"行驶证反面"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-jqx').click(function(){
      				 var list={"id":".img-jqx","text":"交强险保单"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-syx').click(function(){
      				 var list={"id":".img-syx","text":"商业险保单"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			//提交
      			$('#zc').click(function(){
      			
      				for(i=0;i<$('.checkCar-list :text').length;i++){
      					if($('.checkCar-list :text').eq(i).val()==''){
      						$.toast('请填写完整')
      						$('.checkCar-list :text').eq(i).focus()
      						return false
      					}
      				}
      				if($('.img-xsz-z').attr('name')=='0'){$.toast('请上传行驶证正本照片'); return false}
      				if($('.img-xsz-f').attr('name')=='0'){$.toast('请上传行驶证副本照片'); return false}
      				if($('.img-jqx').attr('name')=='0'){$.toast('请上传交强险保单照片'); return false}
      				if($('.img-syx').attr('name')=='0'){$.toast('请上传商业险保单照片'); return false}
      				$.showPreloader()
      				var info_RecheckCar={
      						//'u_userid':sessionStorage.id,
      						'car_carid':sessionStorage.car_carid,
      						'u_userid':my.getCookie('id'),
      						'c_number':$('[name=c_number]').val(),
      						'insurance_num':$('[name=insurance_num]').val(),
      						'busin_num':$('[name=busin_num]').val(),
      						'veh_first_img':$('.img-xsz-z').attr('name'),
      						'veh_second_img':$('.img-xsz-f').attr('name'),
      						'insurance_img':$('.img-jqx').attr('name'),
      						'busin_img':$('.img-syx').attr('name'),
      						'brand_id':$('[name=brand_id]').val(),
      						'brand_name':$('[name=brand_name]').val(),
      						'cars_id':$('[name=cars_id]').val(),
      						'cars_name':$('[name=cars_name]').val(),
      						'models_id':$('[name=models_id]').val(),
      						'models_name':$('[name=models_name]').val(),
      				}
    					info_RecheckCar=JSON.stringify(info_RecheckCar)
    					 //$('.bar-nav').prepend(info)  
                        info_RecheckCar=my.cryptoASEencrypt(info_RecheckCar,key).toString()
                       // $('.bar-nav').prepend(key)
                        //$('.bar-nav').prepend(info)  					
      				$.ajax({
      						type:"post",
      						url:api.usercarsmanage,
      						data:{
      							'api_value':info_RecheckCar
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$.toast("提交失败，请重试..");
      						},
      						success:function(data){
      							$.hidePreloader()
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								}
                                         
      							}else{
      								   $.alert('信息成功，请上传车辆图片',function(){
      								   //$.router.loadPage("carManger.html");
                                           $.router.load(carMangerUrl,true);
      								   })
      							}
      						},
      				});
      						
      			})
})
///////////////////////////page_checkBankCard/////////////////////
$(document).on("pageInit", "#page_checkBankCard", function(e, pageId, $page) {
	                    key=my.get_key(my.getCookie('token'))
      	    			$('.get-yz').click(function(){//验证码获取开始
      				    my.countdown('30','.get-yz')
      				    var u_phone={
      					    u_mobile:encodeURIComponent($('[name=reserved_mobile]').val())
      				    }
      				    u_phone=my.cryptoASEencrypt(JSON.stringify(u_phone),key)
      				    $.ajax({
      					    url:api.sendmobilecode,
      					    type: 'post',
      					    async:true,
      					    data:{
      						        'api_value':u_phone
      					     },
      					    error:function(){
      							$.toast("获取失败，请点击重新获取");
      						 },
      					    success:function(data){
      						   if(data.match("err_code")!=null){	
      							  switch(JSON.parse(data).err_code)
      								 {
      									case 40003:
      									 my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								  }     
      							    }else{
      							            $.toast('验证码发送成功');
      							    }
      					    }
      				     });
      			        })//验证码获取结束
      			        //选择bank开始
      			        $('.sel-bank').click(function(){
      			                $.popup('.popup-bankCard');
      			             $('span[name=yz]').trigger('click')
      			        })
      			         var list=my.getBanks()
      			         $('.get-car-lista span').click(function(){
		                 $('.get-car-lista span').removeClass('active')
		                 $(this).addClass('active')
		                 var name=$(this).attr('name')
		                 $('.get-car-listb span').remove()
		                 $('.get-car-listb').show()
		                 $('.get-car-listc,.get-car-listd,.get-car-other-box,.get-car-other-btn').hide()
		                 for( k in list){
		           	     if(name.match(list[k].bank_spell.substr(0,1).toLowerCase())){
				         var html="<span id='"+list[k].bankcard_id+"'>"+list[k].bank_name+"</span>"
				            $('.get-car-listb').prepend(html)
		                  }
		                }
		                $('.get-car-listb span').click(function(){ 
		                    $('[name=bankcard_id]').val($(this).attr('id'))
                	        $('.sel-bank').text($(this).text())
                	        $.closeModal('.popup')
                                             
	                    })
                     })//选择银行结束
                      $('.btn-bank').click(function(){//提交开始
                      	 $.showPreloader()
                      	 var info={
      					    'u_userid':my.getCookie('id'),
      					    'card_type':1,
      					    'carder_name':encodeURIComponent($('[name=carder_name]').val()),
      						'open_account':encodeURIComponent($('[name=open_account]').val()),
      						'bankcard_id':encodeURIComponent($('[name=bankcard_id]').val()),
      						'reserved_mobile':encodeURIComponent($('[name=reserved_mobile]').val()),
      						'm_mobilecode':encodeURIComponent($('[name=m_mobilecode]').val()),
      						'valid_data':'',
      						'cvtwo_code':'',
      				    }
      				    info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				    $.ajax({
      					    url:api.useraddbankcard,
      					    type: 'post',
      					    async:true,
      					    data:{
      						        'api_value':info
      					     },
      					    error:function(){
      					    	$.hidePreloader()
      							$.toast("提交失败，请点击重新获取");
      						 },
      					    success:function(data){
      					    	$.hidePreloader()
      						   if(data.match("err_code")!=null){	
      							  switch(JSON.parse(data).err_code)
      								 {
      									case 40003:
      									  my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								  }     
      							    }else{
      							            data=JSON.parse(data)
      								        data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								        if(data.result_state=='ok'){
      								        	$.alert('绑定成功！',function(){
        										//$.router.loadPage("cardManger.html");
                                                    $.router.load(cardMangerUrl,true);
        									})
      								        }
      							    }
      					    }
      				     });
                      	
                      })//提交结束
})
////////////////////////////page_checkCar////////////////////////////
$(document).on("pageInit", "#page_checkCar", function(e, pageId, $page) {
	key=my.get_key(my.getCookie('token'))
      	    	 var list=my.getCars()
      			//注册登陆点击效果
      			//选择品牌
      			$('.sel-car').click(function(){
      			   $.popup('.popup');
      			   $('span[name=abc]').trigger('click')
      			})

      		     var other_name=''
      		     var other_id=''
      		    $('.get-car-other').click(function(){
               	  $('.get-car-listb,.get-car-listc,.get-car-listd').hide()
               	  $('.get-car-other-box,.get-car-other-btn').show()
               	  other_name='[name='+$(this).attr('name')+'_name'
               	  other_id='[name='+$(this).attr('name')+'_id'
                })
                $('.get-car-other-btn').click(function(){
                	$('.sel-car').text($('.get-car-other-box').val())
                	$(other_name).val($('.get-car-other-box').val())
                	$(other_id).val(0)
                	$.closeModal('.popup')
                })
	             $('.get-car-lista span').click(function(){
		           $('.get-car-lista span').removeClass('active')
		           $(this).addClass('active')
		           var name=$(this).attr('name')
		           $('.get-car-listb span').not('.get-car-other').remove()
		           $('.get-car-listb').show()
		           $('.get-car-listc,.get-car-listd,.get-car-other-box,.get-car-other-btn').hide()
		           for( k in list){
		           	if(name.match(list[k].benglish_name.substr(0,1))){
				         var html="<span id='"+k+"'>"+list[k].brand_name+"</span>"
				       $('.get-car-listb').prepend(html)
		             }
		           }
		           $('.get-car-listb span').not('.get-car-other').click(function(){
		           	      $('[name=brand_id]').val($(this).attr('id'))
		 	              $('.get-car-listb span').removeClass('active')
		                  $(this).addClass('active')
		                  $('.get-car-listc span').not('.get-car-other').remove()
		                  $('.get-car-listc').show()
		                  $('.get-car-listd span').not('.get-car-other').remove()
		                  $('.get-car-listd').hide()
		                  var j=$(this).attr('id')
		                   for(k in list[j].xi){
				               var html="<span id='"+j+"' name='"+k+"' >"+list[j].xi[k].cars_name+"</span>"
				                   $('.get-car-listc').prepend(html)
		                   }
		                   $('.get-car-listc span').not('.get-car-other').click(function(){
		                   	                    $('[name=cars_id]').val($(this).attr('name'))
		                   	                     $('.get-car-listc span').removeClass('active')
		                                         $(this).addClass('active')
		                                         $('.get-car-listd span').not('.get-car-other').remove()
		                                         $('.get-car-listd').show()
		                                         var j=$(this).attr('id')
		                                         var w=$(this).attr('name')
		                                         for(k in list[j].xi[w].chexing){
				                                       var html="<span id='"+k+"'>"+list[j].xi[w].chexing[k].models_name+"</span>"
				                                           $('.get-car-listd').prepend(html)
		                                            }
		                                          $('.get-car-listd span').not('.get-car-other').click(function(){
		                                          	$('[name=models_id]').val($(this).attr('id'))
                	                                $('.sel-car').text($(this).text())
                	                                $.closeModal('.popup')
                                                  })
	                    })
	                })
                })

      			//上传图片
      			$('.img-xsz-z').click(function(){
      				 var list={"id":".img-xsz-z","text":"行驶证正面"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-xsz-f').click(function(){
      				 var list={"id":".img-xsz-f","text":"行驶证反面"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-jqx').click(function(){
      				 var list={"id":".img-jqx","text":"交强险保单"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-syx').click(function(){
      				 var list={"id":".img-syx","text":"商业险保单"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			//提交
      			$('#zc').click(function(){
      			    $('#zc').addClass('active_btn')
      				for(i=0;i<$('.checkCar-list :text').length;i++){
      					if($('.checkCar-list :text').eq(i).val()==''){
      						$.toast('请填写完整')
      						$('.checkCar-list :text').eq(i).focus()
      						$('#zc').removeClass('active_btn')
      						return false
      					}
      				}
      				if($('.img-xsz-z').attr('name')=='0'){$.toast('请上传行驶证正本照片'); $('#zc').removeClass('active_btn'); return false}
      				if($('.img-xsz-f').attr('name')=='0'){$.toast('请上传行驶证副本照片'); $('#zc').removeClass('active_btn'); return false}
      				if($('.img-jqx').attr('name')=='0'){$.toast('请上传交强险保单照片'); $('#zc').removeClass('active_btn'); return false}
      				if($('.img-syx').attr('name')=='0'){$.toast('请上传商业险保单照片');$('#zc').removeClass('active_btn'); return false}
      				$.showPreloader()
      				var info_checkCar={
      						//'u_userid':sessionStorage.id,
      						'car_carid':0,
      						'u_userid':my.getCookie('id'),
      						'c_number':encodeURIComponent($('[name=c_number]').val()),
      						'insurance_num':encodeURIComponent($('[name=insurance_num]').val()),
      						'busin_num':encodeURIComponent($('[name=busin_num]').val()),
      						'veh_first_img':$('.img-xsz-z').attr('name'),
      						'veh_second_img':$('.img-xsz-f').attr('name'),
      						'insurance_img':$('.img-jqx').attr('name'),
      						'busin_img':$('.img-syx').attr('name'),
      						'brand_id':encodeURIComponent($('[name=brand_id]').val()),
      						'brand_name':encodeURIComponent($('[name=brand_name]').val()),
      						'cars_id':encodeURIComponent($('[name=cars_id]').val()),
      						'cars_name':encodeURIComponent($('[name=cars_name]').val()),
      						'models_id':encodeURIComponent($('[name=models_id]').val()),
      						'models_name':encodeURIComponent($('[name=models_name]').val()),
      				}
    					info_checkCar=JSON.stringify(info_checkCar)
                        info_checkCar=my.cryptoASEencrypt(info_checkCar,key)				
      				$.ajax({
      						type:"post",
      						url:api.usercarsmanage,
      						data:{
      							'api_value':info_checkCar
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      					       	$('#zc').removeClass('active_btn')
      							$.toast("提交失败，请重试..");
      						},
      						success:function(data){
      							$.hidePreloader()
      					       	$('#zc').removeClass('active_btn')
      							if(data.match("err_code")!=null){
      								$.hideIndicator()
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								}
                                         
      							}else{
      								
      								    //data=JSON.parse(my.cryptoASEdencrypt(data,key))
        								//$.toast("提交成功，等待审核");
        								
        								$.alert("信息成功，请上传车辆图片",function(){
        									 //$.router.loadPage("carManger.html");
                                            $.router.load(carMangerUrl,true);
        								})
      							       
      							}
      						},
      				});
      						
      			})
})
//////////////////////////////////////////HOME/////////////////////////////////


///////////////////////////////////////page_login//////////////////////////////
$(document).on("pageInit", "#page_login", function(e, pageId, $page) {
	if(my.getCookie('token')!=false&&my.getCookie('id')!=false){
	               $.router.loadPage("parkIndex.html");
	              }else{
                  //获取key
      		     var key=my.get_key_login(my.get_tokenSeed())
                 $('.bar-nav a').click(function(){
                 	$(this).css('color','#17A6FF')
                 	$(this).siblings().css('color','#ADADAD')
                 })
      			//验证登陆和账号登陆切换
      			$('.yz').click(function(){
      				
      				   $(this).siblings('a').removeClass('active')
      				   $(this).addClass('active')
      				   $('[name=password]').attr('title',2);
      				   //$('.login-list input:eq(1)').val($(this).val())		
      				   $('.login-list-mm').hide()
      				   $('.login-list-yz').show()
      			})
      			$('.mm').click(function(){
      				
      				   $(this).siblings('a').removeClass('active')
      				   $(this).addClass('active')
      				   $('[name=password]').attr('title',1);
      				  // $('.login-list input:eq(1)').val($(this).val())		
      				   $('.login-list-mm').show()
      				   $('.login-list-yz').hide()
      			})
      			//注册登陆点击效果
//    			$('.login-list-b a').click(function(){ 
//    				$(this).css({'color':'#fff','backgroundColor':'#505050'})
//    			})
      			$('#login-list-yz-eq0').change(function(){
      				$('.login-list input')[1].val($(this).val())
      			})
      			//验证码获取
      			$('.get-yz').click(function(){//
      				my.countdown('30','.get-yz')
      				var u_phone={
      					u_mobile:encodeURIComponent($('[name=phone]').val())
      				}
      				u_phone=my.cryptoASEencrypt(JSON.stringify(u_phone),key)
      				$.ajax({
      					url:api.sendmobilecode,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':u_phone
      					},
      					error:function(){
      							$.toast("获取失败，请点击重新获取");
      						},
      					success:function(data){
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.setCookie('token',false,-1);
      									   my.setCookie('id',false,-1);
      									   $.alert("获取失败，请重新获取");
      									   	$.router.reloadPage()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      							$.toast('验证码发送成功');
      							}
      					}
      				});
      			})
      			//登陆提交
   			    $('#dl').click(function(){
   			    	$('#dl').addClass('active_btn')
      				$('[name=phone]').val().replace(/[^\d]/g,'')
      				if($('[name=phone]').val().length!=11){
      					$('#dl').removeClass('active_btn')
      					$.toast('请输入正确手机号码')
      					$('[name=phone]').val('').focus()
      				
      				}else if(my.getCookie('token')==false){  //sessionStorage.token=='undefined'
      					$('#dl').removeClass('active_btn')
      					$.toast('请检查账号密码是否正确')
      					$.router.reloadPage()
      				}else{
      					$.showPreloader()
      					var obj={
      						'u_account':encodeURIComponent($('[name=phone]').val()),
      						'u_password':encodeURIComponent($('[name=password]').val()),
      						'u_logintype':encodeURIComponent($('[name=password]').attr('title'))
      					}
    					obj=JSON.stringify(obj)
                        obj=my.cryptoASEencrypt(obj,key).toString()
      					$.ajax({
      						type:"post",
      						url:api.userlogin,
      						data:{
      							'api_value':obj,
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$('#dl').removeClass('active_btn')
      							$.toast("登陆失败，请重新登陆");
      						},
      						success:function(data){
      							$.hidePreloader()
      							$('#dl').removeClass('active_btn')
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.setCookie('token',false,-1);
      									   my.setCookie('id',false,-1);
      									   $.alert("登陆超时，请重新登陆",function(){
      									   	$.router.reloadPage()
      									   });
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
                                         
      							}else{
        								data=JSON.parse(data)
        								console.log(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
        								my.setCookie('id',data.user_id,'3600000')
        								my.setCookie('phone',$('[name=phone]').val(),'3600000')
        								//$.router.loadPage("parkIndex.html");
                                    $.router.load(parkIndexUrl,true);
      							}
      						},
      					});
      				}
      			})
	           }
});
/////////////////////////////////////////////page_register////////////////////
$(document).on("pageInit", "#page_register", function(e, pageId, $page) {
                var key=null;
                var sessionid=my.getCookie('PHPSESSID');
                key=sessionid+my.get_tokenSeed();
                key=CryptoJS.MD5(key).toString()
                key= CryptoJS.SHA256(key);
      			//表单选中效果切换
//    			$('.login-list input').focus(function(){
//    				$(this).css('color','#fff')
//    			})
//    			$('.login-list input').blur(function(){
//    				$(this).css('color','#5926BF')
//    			})
      			//授权协议切换
      			$('.xy-tab').click(function(){
      				$('.xy-tab a').toggleClass('xy-active')
      				$('.xy-a').toggle()
      				$('.xy-b').toggle()
      			})
      			//注册登陆点击效果
      			$('.login-list-b a').click(function(){
      				$(this).css({'color':'#fff','backgroundColor':'#5926BF'})
      			})
      			//验证电话
      			$('.login-list input').eq(0).blur(function(){
      					$(this).val($(this).val().replace(/[^\d]/g,''))
      					if($(this).val().length!=11){
      						$.toast('请输入正确电话号码')
      					}
      					
      				}
      			)
      			//验证两次密码输入
      			$('.login-list-qr').blur(function(){
      					if($(this).val()!=$('.login-list-mm').val()){
      						$(this).val('')
      						$.toast('两次输入密码不相同')
      					}
      					
      				}
      			)
      			//验证码获取
      			$('.get-yz').click(function(){//
      				my.countdown('30','.get-yz')
      				var u_phone={
      					u_mobile:encodeURIComponent($('[name=u_account]').val()),
      				}
      				u_phone=my.cryptoASEencrypt(JSON.stringify(u_phone),key).toString()
      				$.ajax({
      					type:"post",
      					url:api.sendmobilecode,
      					async:true,
      					data:{
      						'api_value':u_phone
      					},
      					error:function(){
      							$.toast("获取失败，请点击重新获取");
      						},
      					success:function(data){
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   $.alert("验证码获取失败，请重新获取");
      									   key=my.get_key(my.get_tokenSeed())	
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}   
      							}else{
      							$.toast('验证码发送成功');
      							}
      					}
      				});
      			})
      			$('.register-list-sq').click(function(){
      				$.popup('.popup');
      				$('.register-list-sq span').css('background-color','#3C3C3C').attr('name','1')
      				my.countSubmit('15','.xy-count')
      			})
      			$('.xy-no').click(function(){
                        	$('.register-list-sq span').css('background-color','#fff').attr('name','0')
      				        clearTimeout(t)
      			         })
                $('.xy-ok').click(function(){
                        	clearTimeout(t)
                        	$('.register-list-sq span').css('background-color','#3C3C3C').attr('name','1')
                        })
      			$('#zc').click(function(){
      				$('.login-list input').eq(0).val().replace(/[^\d]/g,'')
      				if($('.login-list input').eq(0).val().length<11||$('.login-list input').eq(0).val().length>11){
      					$.toast('请输入正确手机号码')
      					$('.login-list input').eq(0).val('').focus()
      					return false
      				}
      				if($('.login-list-qr').val()!=$('.login-list-mm').val()||$('.login-list-qr').val()==''||$('.login-list-mm').val()==''){
      						$.toast('两次输入密码不相同')
      						return false
      				}
      			   if($('.register-list-sq span').attr('name')=='0'){
      				        	$.alert('请勾选并阅读车速递协议')
      				        return false
      				}
      				$.showPreloader()
      				var info={
      						'u_account':encodeURIComponent($('[name=u_account]').val()),
      						'u_password':encodeURIComponent($('[name=u_password]').val()),
      						'm_mobilecode':encodeURIComponent($('[name=m_mobilecode]').val())
      					}
    					info=JSON.stringify(info)
                        info=my.cryptoASEencrypt(info,key).toString()
                        
      				$.ajax({
      						type:"post",
      						url:api.userregister,
      						data:{
      							'api_value':info
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$.toast("注册失败，请重试..");
      						},
      						success:function(data){
      							$.hidePreloader()
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   $.alert("注册失败，请重新提交");	
      									   key=my.get_key(my.get_tokenSeed())
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
                                         
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
        								my.setCookie('id',data.user_id,'3600000')
      							        //$.router.loadPage("parkIndex.html");
                                    $.router.load(parkIndexUrl,true);
      							}
      						},
      				});
      						
      			})
});


////////////////////////////////////////////PARK//////////////////////////////////////////
////////////////////////////////////////////page_parkIndex////////////////////////////////
$(document).on("pageInit", "#page_parkIndex", function(e, pageId, $page) {
	            if(my.getCookie('token')&&my.getCookie('id')){
	            var key=my.get_key(my.getCookie('token'))
	            $('.bar-tab').show()
         		$('.bannerDown-parkIndex').click(function(){
         			$('.banner-parkIndex').show();
         			$(this).hide()
         		})
         		$('.bannerUp-parkIndex').click(function(){
         			$('.banner-parkIndex').hide();
         			$('.bannerDown-parkIndex').show().css('display','block')
         		})
         		//选择时间
         		 var now=new Date();
         		 $('.start-parkIndex,.end-parkIndex').datetimePicker({
                    value: [now.getFullYear(), now.getMonth()+1, now.getDate(), now.getHours(),now.getMinutes()]
                 });
                 //航班接口
                 $(".flightDate").calendar({
                    // value: ['2015-12-05']
                    onClose:function(){
                    	if($(".flightNum").val().length>3){
                                        //航班接口start
                                        $.showIndicator()
                                        var airinfo={flight_name:$('.flightNum').val(),flight_date:$('.flightDate').val(),}
                                        airinfo=my.cryptoASEencrypt(JSON.stringify(airinfo),key)
                                        $.ajax({
                                            url:api.searchflightinfo,
                                            type: 'post',
                                            async:true,
                                            data:{'api_value':airinfo},
                                            complete:function(){
                                                setTimeout(function(){
                                                    $.hideIndicator()
                                                    $('.flightInfo-ok').removeClass('active_btn').css('color','#ccc')
                                                },500)
                                            },
                                            error:function(){$.toast("航班信息获取失败");},
                                            success:function(data){
                                                if(data.match("err_code")!=null){
                                                    $.hidePreloader()
                                                    switch(JSON.parse(data).err_code)
                                                    {
                                                        case 40003:
                                                            my.tokenExpire()
                                                            break;
                                                        default:
                                                            $.toast(JSON.parse(data).err_msg);
                                                    }
                                                }else{
                                                    $.hidePreloader()
                                                    data=JSON.parse(data)
                                                    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
                                                    sessionStorage.parkPlace_parkReco=JSON.stringify(data)
                                                    console.log(data)
                                                    $('[name=store_id]').val(data.from_store[0].stores_id)
                                                    sessionStorage.flight_num=$('.flightNum').val()
                                                    sessionStorage.flight_store_id=data.from_store[0].stores_id
                                                    sessionStorage.flight_endPlace=data.to_store[0].stores_name
                                                    sessionStorage.flight_endPlace_id=data.to_store[0].stores_id
                                                    sessionStorage.flight_startPlace=data.from_store[0].city_name
                                                    sessionStorage.flight_startPlace_id=data.from_store[0].city_id
                                                    $('.flightInfo-airport_name_start').text('出发机场 '+data.from_store[0].airport_name)
                                                    $('.flightInfo-airport_name_end').text('到达机场 '+data.to_store[0].airport_name)
                                                    $('.flightInfo-qif_time').text(data.time.qif_time)
                                                    $('.flightInfo-dad_time').text(data.time.dad_time)
                                                }
                                            }
                                        });
                                    }else{
                                       $(".flightDate").val('');
                                        $.toast("亲~请先输入正确的航班号");
                                    }
                          }
                       });
                     //航班接口end
                      $('.start-parkIndex,.end-parkIndex').change(function(){
                      	if(!!$('.start-parkIndex').val()&&!!$('.end-parkIndex').val()){
                      		$('.time-parkIndex span').eq(2).text((Date.parse($('.end-parkIndex').val())- Date.parse($('.start-parkIndex').val()))/3600000)
                      		$('.time-parkIndex').show()
                      	}
                      })
                      //协议
                      $('.xy-parkIndex').click(function(){
      				    $.popup('.popup-parkIndex');
      				    $('.xy-parkIndex span').css('background-color','#3C3C3C').attr('name','1')
      				    my.countSubmit('15','.xy-count')
      			      })
      			      $('.xy-no').click(function(){
                        	$('.xy-parkIndex span').css('background-color','#fff').attr('name','0')
      				        clearTimeout(t)
      			         })
                      $('.xy-ok').click(function(){
                        	clearTimeout(t)
                        	$('.xy-parkIndex span').css('background-color','#3C3C3C').attr('name','1')
                      })
                      $('.flightInfo-parkIndex').click(function(){
                      		 $.popup('.popup-flightInfo-parkIndex');
                      })
                      $('.flightInfo-ok').click(function(){

                          //$.closeModal('.flightInfo-ok')
                    //  	$('.flightInfo-ok').addClass('active_btn').css('color','#fff')
                      	$('.flightInfo-parkIndex').val($('.flightNum').val()+'/'+$('.flightDate').val())
                      	$('[name=flight_number]').val($('.flightNum').val())
                      	$('[name=flight_time]').val($('.flightDate').val())

                      })
                      $('.submit-parkIndex').click(function(){
                      	 if($('.xy-parkIndex span').attr('name')=='0'){
                      	 	$.alert('请阅读车去车来泊车协议')
                      	 }else{
                      	 	//ajax开始
                      	 	$.showPreloader()
      				        var info={
      						   'parking_starttime':$('[name=parking_starttime]').val(),
      						   'parking_endtime':$('[name=parking_endtime]').val(),
      						   'store_id':$('[name=store_id]').val(),
      						   'models_id':$('[name=park_models_id]').val(),
      					     }
      				         console.log(info)
    					     info=JSON.stringify(info)
                             info=my.cryptoASEencrypt(info,key).toString()
                        
      				        $.ajax({
      						   type:"post",
      					     	url:api.calculateparkingprice,
      						data:{
      							'api_value':info
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$.toast("提交失败，请重试");
      						},
      						success:function(data){
      							$.hidePreloader()
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
                                         
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    sessionStorage.parking_starttime=$('[name=parking_starttime]').val(),
      								    sessionStorage.parking_endtime=$('[name=parking_endtime]').val(),
      								    sessionStorage.park_total_time=data.total_time
      								    sessionStorage.park_total_price=data.total_price
      								    sessionStorage.parking_unit=data.parking_unit
      								    sessionStorage.parking_unit_price=data.parking_unit_price
      								    sessionStorage.official_price=data.official_price
      								    sessionStorage.is_allowrent=data.is_allowrent
      							       // $.router.loadPage("parkChoosePayment.html");
                                    $.router.load(parkChoosePaymentUrl,true);
      							}
      						},
      				        });
      				        //ajax结束
                      	 }
                      })
                      $('.select-carInfo-parkIndex').click(function(){
                      	$.router.loadPage("#page_parkIndexGetCar");
                      })
                      
                      }else{
	            	$('.page').click(function(){
	            		my.setCookie('token','',-1)
                        my.setCookie('id','',-1)
                        my.setCookie('phone','',-1)
	                    $.alert("请先登录",function(){
                               window.location.href=config.domain+'sui_BMW/login.html';
                        });
	            	})
	            }
});
//////////////////////////////////////////page_parkIndexGetCar////////////////////
$(document).on("pageInit", "#page_parkIndexGetCar", function(e, pageId, $page) {
	        $.showPreloader()
        	key=my.get_key(my.getCookie('token'))
        	var list=my.getCars()
      		     var other_name=''
      		     var other_id=''
      		    $('.get-car-other').click(function(){
               	  $('.get-car-listb,.get-car-listc,.get-car-listd').hide()
               	  $('.get-car-other-box,.get-car-other-btn').show()
               	  other_name='[name='+$(this).attr('name')+'_name'
               	  other_id='[name='+$(this).attr('name')+'_id'
                })
                $('.get-car-other-btn').click(function(){
                	$('.carInfo-parkIndex').val($('.get-car-other-box').val())
                	$(other_name).val($('.get-car-other-box').val())
                	$(other_id).val(0)
                	$.closeModal('.popup')
                	 $('.popup-overlay').hide()
                })
	             $('.get-car-lista span').click(function(){
		           $('.get-car-lista span').removeClass('active')
		           $(this).addClass('active')
		           var name=$(this).attr('name')
		           $('.get-car-listb span').not('.get-car-other').remove()
		           $('.get-car-listb').show()
		           $('.get-car-listc,.get-car-listd,.get-car-other-box,.get-car-other-btn').hide()
		           for( k in list){
		           	if(name.match(list[k].benglish_name.substr(0,1))){
				         var html="<span id='"+k+"'>"+list[k].brand_name+"</span>"
				       $('.get-car-listb').prepend(html)
		             }
		           }
		           $('.get-car-listb span').not('.get-car-other').click(function(){
		           	      $('[name=brand_id]').val($(this).attr('id'))
		 	              $('.get-car-listb span').removeClass('active')
		                  $(this).addClass('active')
		                  $('.get-car-listc span').not('.get-car-other').remove()
		                  $('.get-car-listc').show()
		                  $('.get-car-listd span').not('.get-car-other').remove()
		                  $('.get-car-listd').hide()
		                  var j=$(this).attr('id')
		                   for(k in list[j].xi){
				               var html="<span id='"+j+"' name='"+k+"' >"+list[j].xi[k].cars_name+"</span>"
				                   $('.get-car-listc').prepend(html)
		                   }
		                   $('.get-car-listc span').not('.get-car-other').click(function(){
		                   	                    $('[name=cars_id]').val($(this).attr('name'))
		                   	                     $('.get-car-listc span').removeClass('active')
		                                         $(this).addClass('active')
		                                         $('.get-car-listd span').not('.get-car-other').remove()
		                                         $('.get-car-listd').show()
		                                         var j=$(this).attr('id')
		                                         var w=$(this).attr('name')
		                                         for(k in list[j].xi[w].chexing){
				                                       var html="<span id='"+k+"'>"+list[j].xi[w].chexing[k].models_name+"</span>"
				                                           $('.get-car-listd').prepend(html)
		                                            }
		                                          $('.get-car-listd span').not('.get-car-other').click(function(){
		                                          	$('[name=models_id]').val($(this).attr('id'))
                	                                $('.carInfo-parkIndex').val($(this).text())
                	                                $.closeModal('.popup-getCar')
                	                                $('.popup-overlay').hide()
                                                  })
	                    })
	                })
               })
      		$('.carInfo-parkIndex').click(function(){
      			   $.popup('.popup-getCar');
      			   $('span[name=abc]').trigger('click')
      		})
      		$('.itemLocal-parkIndexGetCar span').click(function(){
      			$(this).addClass('active').siblings().removeClass('active')
      			$('.numlocal-parkIndex label').text($(this).text())
      		})
      		$('.numlocal-parkIndex').click(function(){
      			$('.getCarLoacl-parkIndexGetCAr').show()
      		})
      		$('.n-parkIndexGetCar,.y-parkIndexGetCar').click(function(){
      			$('.getCarLoacl-parkIndexGetCAr').hide()
      		})
      		$('.flightInfo-ok').click(function(){
      			var info={
      				'user_id':my.getCookie('id'),
      				'car_plate':$('.numlocal-parkIndex label').text()+$('.carNum-parkIndex').val(),
      				'brand_id':$('[name=brand_id]').val(),
      				'cars_id':$('[name=cars_id]').val(),
      				'models_id':$('[name=models_id]').val(),
      			}
      			console.log(info)
      			info=JSON.stringify(info)
                info=my.cryptoASEencrypt(info,key)
                $.ajax({
      					url:api.addnewcar,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("车辆信息获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									  my.tokenExpire()
      									   break;    
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    var info=$('.carInfo-parkIndex').val()+'/'+$('.numlocal-parkIndex label').text()+$('.carNum-parkIndex').val()
      			                        $('.select-carInfo-parkIndex').val(info)
      			                        $('[name=user_carid]').val(data.user_carid)
      			                        $('[name=park_models_id]').val(data.models_id)
      			                        sessionStorage.parkChoosePayment_usercar_id=data.user_carid
      			                        sessionStorage.parking_car_plate=data.car_plate
      			                        $.router.load("#page_parkIndex",true); 
      								
      							}
      						}
      				})
      		})
      		//获取车辆信息开始
      		var carinfo_park={'u_userid':my.getCookie('id')}
    				    carinfo_park=JSON.stringify(carinfo_park)
                        carinfo_park=my.cryptoASEencrypt(carinfo_park,key).toString()
      				$.ajax({
      					url:api.usercarlist,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':carinfo_park
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("车辆信息获取失败");
      						},
      					success:function(data){
      						//$.hidePreloader()
      						if(data.match("err_code")!=null){
      							$('.mycarpark').hide()
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									  my.tokenExpire()
      									   break;
//    									case 50250:
//    									    $.alert('请先入驻车辆',function(){
//    									    	$.router.loadPage("carManger.html");
//    									    });
//    									    break;
//    									case 50380:
//    									    $.alert('没有已认证的车辆',function(){
//    									    	$.router.loadPage("home.html");
//    									    });
//    									    break;    
      									default:
      									   console.log(JSON.parse(data).err_msg);
      								}     
      							}else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								        $('.mycarpark').show()
      								    	for(y=0;y<data.length;y++){
      								    		  $('.parIndexGetCar-myCar').append('<div class="parIndexGetCar-myCar-item" data-models_id="'+data[y].models_id+'" name="'+data[y].usercar_id+'"><div><span class="iconfont icon-qiche"></span><span class="brand_chinese_name">'+data[y].brand_chinese_name+'</span><div class="clear"></div></div><div class="car_plate">'+data[y].car_plate+'</div></div>')
      								    	}
      								    	$('.parIndexGetCar-myCar-item').click(function(){
                        	                   var info=$(this).find('.brand_chinese_name').text()+'/'+$(this).find('.car_plate').text()
      			                               $('.select-carInfo-parkIndex').val(info)
      			                               $('[name=park_models_id]').val($(this).attr('data-models_id'))
      			                               $('[name=user_carid]').val($(this).attr('name'))
      			                               sessionStorage.parkChoosePayment_usercar_id=$(this).attr('name')
      			                               sessionStorage.parking_car_plate=$(this).find('.car_plate').text()
      			                               $.router.load("#page_parkIndex"); 
      			                               $('.bar-tab').show()
                                            })
//    								    
      							}
      					}
      				});
      		//获取车辆信息结束
      		$.hidePreloader()
});
//////////////////////////////////page_parkChoosePayment///////////////////////////////
$(document).on("pageInit", "#page_parkChoosePayment", function(e, pageId, $page) {
	            var key=my.get_key(my.getCookie('token'))
	            $('#pay_jszj_starttime').val(sessionStorage.parking_starttime)
	            $('#pay_jszj_endtime').val(sessionStorage.parking_endtime)
	            $('#Estimated-carprice').val(sessionStorage.official_price)
	            $('#Estimated-carplate').val(sessionStorage.parking_car_plate)
	            $('#Estimated-time').val(sessionStorage.parking_starttime+'-'+sessionStorage.parking_endtime)
	            $('#Estimated-local').val(sessionStorage.flight_startPlace).attr('title',sessionStorage.flight_startPlace_id)
	            $('.pay_jszj').click(function(){
	            	var pay_jszj={
      						   'starttime':$('#pay_jszj_starttime').val(),
      						   'endtime':$('#pay_jszj_endtime').val(),
      						   'buying_price':$('#Estimated-carprice').val(),
      						   'timedifference':$('#Estimated-old').val(),
      						   'store_id':sessionStorage.flight_store_id,
      					     }
	                     console.log(pay_jszj)
	                     pay_jszj=JSON.stringify(pay_jszj)
                         pay_jszj=my.cryptoASEencrypt(pay_jszj,key)
                         $.ajax({
      						   type:"post",
      					     	url:api.calculaterent,
      						data:{
      							'api_value':pay_jszj
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$.toast("提交失败，请重试");
      						},
      						success:function(data){
      							$.hidePreloader()
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
                                         
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    $('#pay_workprice').text(data.workprice)
      								    $('#pay_weekprice').text(data.weekprice)
      								    $('#pay_festivalprice').text(data.festivalprice)
      								    $('#pay_total_prices').text(data.total_prices)
      								    
      							}
      						},
      				        });
      				        //ajax结束
	            })
           		//$('.parkChoosePrice-p').html(sessionStorage.park_total_price+'<label>元</label>')
           		if(sessionStorage.is_allowrent==1){
           			$('.parkChooseItem').click(function(){
           			  $(this).addClass('parkChooseItemActive').siblings().removeClass('parkChooseItemActive')
           		   })
           		   $('.parkChooseItem').eq(1).click(function(){
           			   $('[name=is_rent]').val(0)
           			   $('.parkChoosePrice-p').html(sessionStorage.park_total_price+'<label>元</label>')
           			   $('.parkChoosePay-Estimated').hide()
           		    })
           		   $('.parkChooseItem').eq(0).click(function(){
           			   $('[name=is_rent]').val(1)
           			   $('.parkChoosePrice-p').html('0.0<label>元</label>')
           			   $('.parkChoosePay-Estimated').show()
           		   })
           		}else{
           			   $('.parkChooseItem').eq(1).addClass('parkChooseItemActive').siblings().removeClass('parkChooseItemActive')
           			   $('[name=is_rent]').val(0)
           			   $('.parkChoosePrice-p').html(sessionStorage.park_total_price+'<label>元</label>')
           			   $('.parkChoosePay-Estimated').hide()
           		       $('.parkChooseItem').eq(0).click(function(){
           			      $.alert('当前车辆不符合出租要求...')
           		       })
           		}
           		
           		$('.parking_unit').text(sessionStorage.parking_unit_price+'元/'+sessionStorage.parking_unit+'时')
           		$('.parkChooseSubmit').click(function(){
                      	 	$.showPreloader()
      				        var info_parkpay={
      						   'user_id':my.getCookie('id'),
      						   'parking_starttime':sessionStorage.parking_starttime,
      						   'parking_endtime':sessionStorage.parking_endtime,
      						   'flight_number':sessionStorage.flight_num,
      						   'usercar_id':sessionStorage.parkChoosePayment_usercar_id,
      						   'store_id':sessionStorage.flight_store_id,
      						   'is_rent':$('[name=is_rent]').val(),
      					     }
      				        console.log(info_parkpay)
    					     info_parkpay=JSON.stringify(info_parkpay)
                             info_parkpay=my.cryptoASEencrypt(info_parkpay,key)
                           
      				        $.ajax({
      						   type:"post",
      					     	url:api.addparkingorder,
      						data:{
      							'api_value':info_parkpay
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      							$.toast("提交失败，请重试");
      						},
      						success:function(data){
      							$.hidePreloader()
      							if(data.match("err_code")!=null){
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
                                         
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    if($('[name=is_rent]').val()==1){
           				                     sessionStorage.parkRecoTime=$('[name=parking_starttime]').val()+'-'+$('[name=parking_endtime]').val()
           				                     if(data.car_identity<0){
           				                     	sessionStorage.usercar_id_parkCheckCar=data.usercar_id
           				                     	//$.router.loadPage("parkCheckCar.html");
                                                 $.router.load(parkCheckCarUrl,true);
           				                     }else{
           				                     	//$.router.loadPage("parkRecommend.html");
           				                     	 $.router.load(parkRecommendUrl,true);          				                     }
           				                     
           			                    }else{
           			                    	 sessionStorage.parkRecoTime=$('[name=parking_starttime]').val()+'-'+$('[name=parking_endtime]').val()
      								         sessionStorage.park_waitfp_id=data.waitfp_id
      								         sessionStorage.park_parking_id=data.parking_id
      							            // $.router.loadPage("zhifu_Park.html");
                                            $.router.load(zhifu_ParkUrl,true);
      							         }
      							}
      						},
      				        });
      				        //ajax结束
      				       
           		})
});
//////////////////////////////////////////////////////////page_parkRecommend//////////////////////////
$(document).on("pageInit", "#page_parkRecommend", function(e, pageId, $page) {
	                $.showPreloader()
			        var carListsort=''
                    var pageNow=1
			        $('.parkRecoLocal').val(sessionStorage.flight_endPlace)
			        
			        $('[name=park_place]').val(sessionStorage.flight_endPlace_id)
			        $('[name=parking_starttime').datetimePicker({});
			        $('[name=parking_endtime').datetimePicker({});
			        $('[name=parking_starttime').val(sessionStorage.parking_starttime)
			        $('[name=parking_endtime').val(sessionStorage.parking_endtime)
			        var key=my.get_key(my.getCookie('token'))
					var info = {
						user_id: my.getCookie('id'),
						car_place:$('[name=park_place]').val(),
						start_time:$('[name=parking_starttime').val(),
						end_time:$('[name=parking_endtime').val(),
						scb: '',
						seat: '',
						city: '',
						page: 1,
						rows: 10,
						brandid: '',
						carsid: '',

					}
					console.log(info)
					info = my.cryptoASEencrypt(JSON.stringify(info), key)
					$.ajax({
						url: api.selectvehicle,
						type: 'post',
						async: false,
						data: {
							'api_value': info
						},
						error: function() {
							$.hidePreloader()
							$.toast("提交失败，请重试！");
						},
						success: function(data) {
							$.hidePreloader()
							if(data.match("err_code") != null) {
								switch(JSON.parse(data).err_code) {
									case 40003:
										my.tokenExpire()
										break;
									default:
										$.alert(JSON.parse(data).err_msg)

								}
							} else {
								data = JSON.parse(data)
								data = JSON.parse(my.cryptoASEdencrypt(data.data, key))
								carListsort = data.car_list
								console.log(carListsort)
								carListsort.sort(function(x, y) {
										return x.work_day_price - y.work_day_price
									})
									//sessionStorage.rentalCal_list=JSON.stringify(data.car_list)
								$('header').show()
								$('.carlist').show()
								$('.carR-car-list ul').empty()
//								if(data.car_list.length < 10) {
//									$('.parkReco-more').hide();
//								}
								for(i = 0; i < data.car_list.length; i++) {

									var usercar_nickname = data.car_list[i].usercar_nickname ? data.car_list[i].usercar_nickname.substr(0, 2) + '***' : '未填写'
									var speed_changing_box
									if(data.car_list[i].speed_changing_box == 1) {
										speed_changing_box = '手动'
									} else if(data.car_list[i].speed_changing_box == 2) {
										speed_changing_box = '自动'
									}
									switch(+data.car_list[i].seat) {
										case 1:
											seat = "2座";
											break;
										case 2:
											seat = "5座";
											break;
										case 3:
											seat = "7座";
											break;
										case 4:
											seat = "7座以上";
											break;
									}
									var list = '<li title="' + i + '" id="' + data.car_list[i].usercar_id + '"><div><img style="height: 8rem;max-width: 100%;" src="' + config.url_car + data.car_list[i].models_logo + '"></div><div>' +
										data.car_list[i].brand_chinese_name + '/' + data.car_list[i].models_name + '</div><div><span>' +
										data.car_list[i].work_day_price + ' 元起</span><span style="float: right;color: #fff;"></span><div class="clear"></div></div>' +
										'<div class="qcxq">' + usercar_nickname + '/' + data.car_list[i].usercar_color + '/' + speed_changing_box + '/行李箱' +
										data.car_list[i].trunk_capacity + 'L/' + seat + '</div></li>'
									$('.carR-car-list ul').append(list)

								}
								$('.carR-car-list ul li').click(function() {
									var id = $(this).attr('title')
									sessionStorage.rentalCalDetails = JSON.stringify(data.car_list[id])
									sessionStorage.carDetails_carid = data.car_list[id].usercar_id
									sessionStorage.car_place=$('[name=park_place]').val()
      					            sessionStorage.rangTimeStart=$('[name=parking_starttime').val()
      					            sessionStorage.rangTimeEnd=$('[name=parking_endtime').val()
									//$.router.loadPage("carDetails.html");
                                    $.router.load(carDetailsUrl,true);
								})

							}
						}
				})
					  //加载更多
				    $('.parkReco-more').click(function(){
				    $.showPreloader()
                    pageNow=Math.ceil($('.carR-car-list ul li').length/10+0.01)
                    setTimeout(function() {
                  var info = {
						user_id: my.getCookie('id'),
						car_place:$('[name=park_place]').val(),
						start_time:$('[name=parking_starttime').val(),
						end_time:$('[name=parking_endtime').val(),
						scb: '',
						seat: '',
						city: '',
						page: 1,
						rows: 10,
						brandid: '',
						carsid: '',

					}
                  console.log(info)
      				        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				        $.ajax({
      					       url:api.selectvehicle,
      					       type: 'post',
      					       async:false,
      					       data:{'api_value':info},
      					       error:function(){
      					       	   $.hidePreloader()
      					       	   $('#carRental-submit').removeClass('active_btn')
      					       	   $.toast("提交失败，请重试！");},
      					       success:function(data){
      					       	   $.hidePreloader()
      						     if(data.match("err_code")!=null){
      						     	$('.carR-car-list ul').empty()
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg)
      								}     
      						     }else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    //carListsort=carListsort.concat(data.car_list)
      								   // carListsort.sort(function(x,y){return x.work_day_price-y.work_day_price})
      								    
      	    	   	                       if(data.car_list.length!=0){
      	    	   		                       if(pageNow==1){
      	    	   		                               $('.carR-car-list ul').empty()	
      	    	   		                          }
      	    	   		                   for(i=0;i<data.car_list.length;i++){
      				                    	  var usercar_nickname=data.car_list[i].usercar_nickname.substr(0,2)+'***'
      				                    	  var speed_changing_box
      				                    	  if(data.car_list[i].speed_changing_box==1){
      				                    		speed_changing_box='手动'
      				                    	    }else if(data.car_list[i].speed_changing_box==2){
      				                    		speed_changing_box='自动'
      				                    	    }
      				                    	    switch(+data.car_list[i].seat){
      				                    		case 1:
      				                    		seat="2座";
      				                    		break;
      				                    		case 2:
      				                    		seat="5座";
      				                    		break;
      				                    		case 3:
      				                    		seat="7座";
      				                    		break;
      				                    		case 4:
      				                    		seat="7座以上";
      				                    		break;
      				                    	}
      				                            var list='<li title="'+i+'" id="'+data.car_list[i].usercar_id+'"><div><img style="height: 8rem;max-width: 100%;" src="'+config.url_car+data.car_list[i].models_logo+'"></div><div>'
		                                          +data.car_list[i].brand_chinese_name+'/'+data.car_list[i].models_name+'</div><div><span>'
		                                          +data.car_list[i].work_day_price+' 元起</span><span style="float: right;color: #fff;"></span><div class="clear"></div></div>'
		                                          +'<div class="qcxq">'+usercar_nickname+'/'+data.car_list[i].usercar_color+'/'+speed_changing_box+'/行李箱'
                                                  +data.car_list[i].trunk_capacity+'L/'+seat+'</div></li>'
      				                            $('.carR-car-list ul').append(list)
      				                       
      				                       }
      	    	                           
      	    	                           $('.carR-car-list ul li').click(function() {
									var id = $(this).attr('title')
									sessionStorage.rentalCalDetails = JSON.stringify(data.car_list[id])
									sessionStorage.carDetails_carid = data.car_list[id].usercar_id
									sessionStorage.car_place=$('[name=park_place]').val()
      					            sessionStorage.rangTimeStart=$('[name=parking_starttime').val()
      					            sessionStorage.rangTimeEnd=$('[name=parking_endtime').val()
									//$.router.loadPage("carDetails.html");
                                               $.router.load(carDetailsUrl,true);
								})
      	    	                           }else{
      	    	     	                       $.alert('没有了')
      	    	                            }
                                           
      							}
      					    }
      			         })
      			    }, 2000);
      			  })
//             //加载更多结束
//           //门店
                 $('.parkRecoLocal').click(function(){
                 	$('.parkRcom_parkPlace').show()
                 })
                 var parkRcom_parkPlace=JSON.parse(sessionStorage.parkPlace_parkReco)
                     for(var i=0;i<parkRcom_parkPlace.to_store.length;i++){
                     	 var list='<div name='+parkRcom_parkPlace.to_store[i].stores_id+'>'+parkRcom_parkPlace.to_store[i].stores_name+'</div>'
                     	 $('.parkRcom_parkPlace').append(list)
                     }
                     $('.parkRcom_parkPlace div').click(function(){
                     	$('.parkRecoLocal').val($(this).text())
                     	$('[name=park_place]').val($(this).attr('name'))
                     	$('.parkRcom_parkPlace').hide()
                     })
              //门店
})
/////////////////////////////////page_parkCheckCar///////////////////////
$(document).on("pageInit", "#page_parkCheckCar", function(e, pageId, $page) {
	$('.bar').show()
      	    	 key=my.get_key(my.getCookie('token'))   	    	
      			//上传图片
      			$('.img-xsz-z').click(function(){
      				 var list={"id":".img-xsz-z","text":"行驶证正面"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-xsz-f').click(function(){
      				 var list={"id":".img-xsz-f","text":"行驶证反面"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-jqx').click(function(){
      				 var list={"id":".img-jqx","text":"交强险保单"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			$('.img-syx').click(function(){
      				 var list={"id":".img-syx","text":"商业险保单"}
      			         list=JSON.stringify(list)
      				 ad.native_get_photo(list)
      			})
      			//提交
      			$('#zc').click(function(){
      			    $('#zc').addClass('active_btn')
      				$.showPreloader()
      				var info_checkCar={
      						//'u_userid':sessionStorage.id,
      						'car_carid':sessionStorage.usercar_id_parkCheckCar,
      						'u_userid':my.getCookie('id'),
      						'c_number':'',
      						'insurance_num':'',
      						'busin_num':'',
      						'veh_first_img':$('.img-xsz-z').attr('name'),
      						'veh_second_img':$('.img-xsz-f').attr('name'),
      						'insurance_img':$('.img-jqx').attr('name'),
      						'busin_img':$('.img-syx').attr('name'),
      						'brand_id':'',
      						'brand_name':'',
      						'cars_id':'',
      						'cars_name':'',
      						'models_id':'',
      						'models_name':'',
      				}
      				console.log(info_checkCar)
    					info_checkCar=JSON.stringify(info_checkCar)
                        info_checkCar=my.cryptoASEencrypt(info_checkCar,key)				
      				$.ajax({
      						type:"post",
      						url:api.usercarsmanage,
      						data:{
      							'api_value':info_checkCar
      						},
      						async:true,
      						error:function(){
      							$.hidePreloader()
      					       	$('#zc').removeClass('active_btn')
      							$.toast("提交失败，请重试..");
      						},
      						success:function(data){
      							$.hidePreloader()
      					       	$('#zc').removeClass('active_btn')
      							if(data.match("err_code")!=null){
      								$.hideIndicator()
      								switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								}
                                         
      							}else{
                                    $.router.load(parkRecommendUrl,true);
        									 //$.router.loadPage("parkRecommend.html");
      							}
      						},
      				});
      						
      			})
})
////////////////////////////////////////////PARK//////////////////////////////////////////



///////////////////////////////////////////////////ORDER///////////////////////////////////
////////////////////////////////page_parkOrder////////////////////////////
$(document).on("pageInit", "#page_parkOrder", function(e, pageId, $page) {
      	    	   $('.infinite-scroll-preloader').show();
                   $('.infiniteOver').hide()
      	    	   var key=my.get_key(my.getCookie('token'))
      	    	   var loading = false;
                   var RentalOrderType=1
                   var pageNow=1
                   var orderActiveList=my.getParkOrderList(my.getCookie('id'),'','',key,1)
                   console.log(orderActiveList)
                    setTimeout(function(){
      	    	   if(orderActiveList!=''){
      	    	   	$('.order-list-parkOrder').empty()
      	    	    for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	  var list='<li id="'+orderActiveList.order_list[i].parking_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_num+'</span><span>泊车编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_carid+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_starttime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'
           	    	
           	           $('.order-list-parkOrder').prepend(list)
      	    	   }
      	    	    if(orderActiveList.order_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	   $('.order-list-parkOrder li').click(function(){
      	    	   	sessionStorage.parking_id_parkOrderDetails=$(this).attr('id')
      	    	   	$.router.loadPage("parkOrderDetails.html");
      	    	   })
      	    	   }else{
      	    	   	    $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	   }
      	    	   },1000);
      	    	   
      	    	   //获取行程中订单开始
      	    	   $('.orderActive').click(function(){
      	    	   	RentalOrderType=1
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	$('.order-list-parkOrder').empty()
      	    	   	$('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()
      	    	   	var orderActiveList=my.getParkOrderList(my.getCookie('id'),'','',key,1)
      	    	   	setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	   		$('.order-list-parkOrder').empty()
      	    	      for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	    var list='<li id="'+orderActiveList.order_list[i].parking_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_num+'</span><span>泊车编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_carid+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_starttime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	            
           	    	            $('.order-list-parkOrder').prepend(list)
      	    	       }
      	    	      if(orderActiveList.order_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	       $('.order-list-parkOrder li').click(function(){
      	    	   	     sessionStorage.parking_id_parkOrderDetails=$(this).attr('id')
      	    	   	     $.router.loadPage("parkOrderDetails.html");
      	    	       })
      	    	     }else{
      	    	   	    $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	   }
      	    	     },1000);
      	    	   	
      	    	   })
      	    	   //获取行程中订单结束
      	    	    //获取已完成订单开始
      	    	   $('.orderOver').click(function(){
      	    	   	RentalOrderType=2
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	$('.order-list-parkOrder').empty()
      	    	   	$('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()
      	    	   	var orderActiveList=my.getParkOrderList(my.getCookie('id'),'','',key,2)
      	    	   	setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	   		$('.order-list-parkOrder').empty()
      	    	      for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	     var list='<li id="'+orderActiveList.order_list[i].parking_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_num+'</span><span>泊车编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_carid+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_starttime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'   
           	    	            $('.order-list-parkOrder').prepend(list)
      	    	       }
      	    	      if(orderActiveList.order_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	      $('.order-list-parkOrder li').click(function(){
      	    	   	    sessionStorage.parking_id_parkOrderDetails=$(this).attr('id')
      	    	   	//$.router.loadPage("parkOrderDetails.html");
                          $.router.load(parkOrderDetailsUrl,true);
      	    	       })
      	    	     }else{
      	    	     	
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()	
      	    	     	
      	    	   	    
      	    	   }
      	    	     },1000)
      	    	   	
      	    	   })
      	    	   //获取已完成订单结束
      	    	   //获取异常订单开始
      	    	   $('.orderAbnormal').click(function(){
      	    	   	RentalOrderType=3
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	$('.order-list-parkOrder').empty()
      	    	   	$('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()
      	    	   	var orderActiveList=my.getParkOrderList(my.getCookie('id'),'','',key,3)
      	    	   	setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	   		$('.order-list-parkOrder').empty()
      	    	      for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	     var list='<li id="'+orderActiveList.order_list[i].parking_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_num+'</span><span>泊车编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_carid+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_starttime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	      
           	    	            $('.order-list-parkOrder').prepend(list)
      	    	       }
      	    	      if(orderActiveList.order_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	      $('.order-list-parkOrder li').click(function(){
      	    	   	    sessionStorage.parking_id_parkOrderDetails=$(this).attr('id')
      	    	   //	$.router.loadPage("parkOrderDetails.html");
                          $.router.load(parkOrderDetailsUrl,true);
      	    	       })
      	    	     }else{
      	    	   	    $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	   }
      	    	     },1000);
      	    	   	
      	    	   })
      	    	   //获取异常订单结束
      	    	   //无限加载
      	    	    $(document).off("infinite").on("infinite", ".infinite-scroll-parkOrder", function() {
                    // 如果正在加载，则退出
                    if (loading) return;
                    pageNow=Math.ceil($('.order-list-parkOrder li').length/10+0.01)
                    console.log('pageNow:'+pageNow)
                    console.log('类型id:'+RentalOrderType)
                    loading = true;
                    setTimeout(function() {
                    loading = false;
                    var orderActiveList=my.getParkOrderList(my.getCookie('id'),'10',pageNow,key,RentalOrderType)
      	    	   	if(orderActiveList!=''){
      	    	   		if(pageNow==1){
      	    	   		   $('.order-list-parkOrder').empty()	
      	    	   		}
      	    	   		console.log('载入条数:'+orderActiveList.order_list.length)
      	    	        for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	            var list='<li id="'+orderActiveList.order_list[i].parking_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_num+'</span><span>泊车编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_carid+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_starttime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].parking_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	      
           	    	            $('.order-list-parkOrder').append(list)
      	    	       }
      	    	       if(orderActiveList.order_list.length<10){
      	    	           $.detachInfiniteScroll($('.infinite-scroll'));
                           $('.infinite-scroll-preloader').hide();
                           $('.infiniteOver').show()
      	    	       }
      	    	       $('.order-list-parkOrder li').click(function(){
      	    	      	 sessionStorage.parking_id_parkOrderDetails=$(this).attr('id')
      	    	   	//$.router.loadPage("parkOrderDetails.html");
                           $.router.load(parkOrderDetailsUrl,true);
      	    	       })
      	    	     }else{
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }
                   }, 2000);
               });
});
///////////////////////////////////page_parkOrderDetails////////////////////
$(document).on("pageInit", "#page_parkOrderDetails", function(e, pageId, $page) {
	                 $.showPreloader()
      			    var key=my.get_key(my.getCookie('token'))
      			    var store_id=''
      			    var start_time=''
      			    var end_time=''
      	    	     //订单详情开始
                    var info={parking_id:sessionStorage.parking_id_parkOrderDetails}
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.parkingorderinfo,
      					type: 'post',
      					async:false,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("订单详情获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    store_id=data.info.store_id
      								    start_time=data.info.parking_starttime
      								    end_time=data.info.parking_endtime
      								    $('.clxhh').text(data.info.brand_chinese_name+''+data.info.cars_name)
      								    $('.usercar_nickname').text(data.info.car_carid)
      								    $('.stores_name').text(data.info.stores_name)
      								    $('.order_startime').text(data.info.parking_starttime)
      								    $('.order_endtime').text(data.info.parking_endtime)
      								    $('.parking_price').text(data.info.parking_price)
      								    if(data.info.zhifu_count!=0){
      								    	for(var i=0;i<data.zhifu_button.length;i++){
      								    		if(data.zhifu_button[i].waitfp_status==0){
      								    			var list='<div class="zfxm-zf bottn btn-zf" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'" title="'+data.zhifu_button[i].waitfp_cost+'">待支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').empty().append(list)
      								    		}else if(data.zhifu_button[i].waitfp_status==1)
      								    		{
      								    			var list='<div class="zfxm-xq bottn" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'">已支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').empty().append(list)
      								    		}
      								    	}
      								    	$('.zfxm-zf').click(function(){
      								    		sessionStorage.park_waitfp_id=$(this).attr('id')
      								    		sessionStorage.park_parking_id=sessionStorage.parking_id_parkOrderDetails
                    	                        //$.router.loadPage("zhifu_Park.html");
                                                $.router.load(zhifu_ParkUrl,true);
      								    	})
      								    }
//    								    
      						}
      					}
      				})
                    //订单详情结束
      	    	    //修改车时开始
                     var cal_end_Y=end_time.substr(0,4)
                     var cal_end_M=end_time.substr(5,2)-1
                     var cal_end_D=end_time.substr(8,2)
                     var cal_end_H=end_time.substr(11,2)
                     $("#rang-time").datetimePicker({
                         value: [cal_end_Y,cal_end_M+1, cal_end_D, cal_end_H, '00'],
                         onClose:function(){
                         	$.confirm('确认修改？', function () {
                         	 var info={
      					            parking_id:sessionStorage.parking_id_parkOrderDetails,
      					            store_id:store_id,
      					            yuan_parking_starttime:start_time,
      					            update_parking_endtime:$("#rang-time").val(),
      					            user_id:my.getCookie('id'),
      				               }
		               	           console.log(info)
		                           $.showPreloader()
      				               info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				               $.ajax({
      					url:api.updateparkingtime,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.alert("修改租期失败，请重新修改");
      						},
      				    complete:function(){
      				    	$("#rang-time").val('修改结束泊车时间')
      				    },
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								}     
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $.alert('修改成功',function(){
      								       $.router.reloadPage()	
      								    })
      								   
      							        
      							}
      					}
      				});
                           },
                           function(){
                           	  $("#rang-time").val('修改结束泊车时间')
                             }
                         	);
                         	//结束
                         }
                     });
                     $("#rang-time").val('修改结束泊车时间')
//    	    	     var now=new Date();
//                     $('#rang-time').mobiscroll().datetime({	
//                     theme: 'mobiscroll',	
//                     display: 'bottom',
//                     lang:'zh',
//                     showLabel:true,
//                     rows:3,
//                     defaultValue:new Date(cal_end_Y,cal_end_M,cal_end_D,cal_end_H),
//                     minDate: new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours()),
//                     dateFormat: 'yy-mm-dd',
//                     timeFormat: 'HH',
//                     timeWheels: 'H', 
//		               timeText:'选择时间',
//		               dateOrder: 'yy M d',
//		               monthText: '月',
//		               dayText: '日',
//	                   yearText:'年',
//		               hourText:'时',
//		               monthNamesShort:"1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月".split(","),
//		               dayNamesShort: ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'],
//		               fromText:'开始时间',
//		               toText:'结束时间',
//		               invalid: [
//                                    { start: '00:00', end: '07:00' }, // Every day
//                                    { start: '21:00', end: '23:59' }, // Every day
////                                    { d: 'w6', start: '00:00', end: '08:59' }, // Saturday
////                                    { d: 'w6', start: '17:00', end: '23:59' }, // Saturdayexact date
//                                   ],
//		               onChange:function(valueText, inst){
//		              	       console.log(valueText+":00:00")  
//		                    },
//		               onSelect:function(valueText, inst) {
//		               	
//		               	   var info={
//    					parking_id:sessionStorage.parking_id_parkOrderDetails,
//    					store_id:store_id,
//    					yuan_parking_starttime:start_time,
//    					update_parking_endtime:valueText+":00:00",
//    					user_id:my.getCookie('id'),
//    				}
//		               	   console.log(info)
//		            $.showPreloader()
//    				info=my.cryptoASEencrypt(JSON.stringify(info),key)
//    				$.ajax({
//    					url:api.updateparkingtime,
//    					type: 'post',
//    					async:true,
//    					data:{
//    						'api_value':info
//    					},
//    					error:function(){
//    						    $.hidePreloader()
//    							$.toast("修改租期失败，请重新修改");
//    						},
//    					success:function(data){
//    						$.hidePreloader()
//    						if(data.match("err_code")!=null){	
//    							switch(JSON.parse(data).err_code)
//    								{
//    									case 40003:
//    									   my.tokenExpire()
//    									   break;
//    									default:
//    									   $.toast(JSON.parse(data).err_msg);
//    								}     
//    							}else{
//    								    data=JSON.parse(data)
//    								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
//    								    $.alert('修改成功',function(){
//    								       $.router.reloadPage()	
//    								    })
//    								   
//    							        
//    							}
//    					}
//    				});
//		               	  
//		                },
//		                onClosed:function(valueText, inst){
//		              	         
//		                    },
//		                onBeforeShow:function(inst){
//		              	        
//		                    }
//                     });
      	    	    //修改过车时结束
      	    	    //取消订单开始
      	    	    $('.qxdd').click(function(){
      	    	       $.confirm('确认要取消么？',function(){
      	    	       	$.showPreloader()
      	    	    $('.qxdd').addClass('active_btn')
                    var info_del={
                    	        parking_id:sessionStorage.parking_id_parkOrderDetails,
                    	        user_id:my.getCookie('id')
                            }
                        info_del=my.cryptoASEencrypt(JSON.stringify(info_del),key)
                       
      				$.ajax({
      					url:api.cancelparkingorder,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_del
      					},
      					error:function(){
      						    $.hidePreloader()
      						    $('.qxdd').removeClass('active_btn')
      							$.toast("订单取消失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							$.pullToRefreshDone('.pull-to-refresh-content');
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						         $('.qxdd').removeClass('active_btn')
      						         $.alert('取消成功',function(){
      							    // $.router.loadPage("parkOrder.html");
                                         $.router.load(parkOrderUrl,true);
      						    })
      						         }
      					}
      				  })
      	    	    	
      	    	       })
      	    	    
      			    })
      	    	    //取消订单结束
      	    	     //下拉刷新start
      		    $(document).on('refresh', '.pull-to-refresh-content-rentalCarOrderDetails',function() {
      		    	 //订单详情开始
                    var info={parking_id:sessionStorage.parking_id_parkOrderDetails}
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.parkingorderinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      						    $.pullToRefreshDone('.pull-to-refresh-content');
      							$.toast("订单详情获取失败");
      						},
      					success:function(data){
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							$.pullToRefreshDone('.pull-to-refresh-content');
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      					 		        $.hidePreloader()
      							        $.pullToRefreshDone('.pull-to-refresh-content');
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    store_id=data.info.store_id
      								    start_time=data.info.parking_starttime
      								    end_time=data.info.parking_endtime
      								    $('.clxhh').text(data.info.brand_chinese_name+''+data.info.cars_name)
      								    $('.usercar_nickname').text(data.info.car_carid)
      								    $('.stores_name').text(data.info.stores_name)
      								    $('.order_startime').text(data.info.parking_starttime)
      								    $('.order_endtime').text(data.info.parking_endtime)
      								    $('.parking_price').text(data.info.parking_price)
      								   if(data.info.zhifu_count!=0){
      								     	$('.zf-btn-list').empty()
      								    	for(var i=0;i<data.zhifu_button.length;i++){
      								    		if(data.zhifu_button[i].waitfp_status==0){
      								    			var list='<div class="zfxm-zf bottn btn-zf" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'" title="'+data.zhifu_button[i].waitfp_cost+'">待支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}else if(data.zhifu_button[i].waitfp_status==1)
      								    		{
      								    			var list='<div class="zfxm-xq bottn" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'">已支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}
      								    	}
      								    	$('.zfxm-zf').click(function(){
      								    		sessionStorage.park_waitfp_id=$(this).attr('id')
      								    		sessionStorage.park_parking_id=sessionStorage.parking_id_parkOrderDetails
                    	                        //$.router.loadPage("zhifu_Park.html");
                                                $.router.load(zhifu_ParkUrl,true);
      								    	})
      								    }
      								    
      								    
      						}
      					}
      				})
                    //订单详情结束
                });//下拉刷新end
});
/////////////////////////////////////////////////page_carRental//////////////////
$(document).on("pageInit", "#page_carRental", function(e, pageId, $page) {
	 key=my.get_key(my.getCookie('token'))
      	    	    var car_data_stra=new Array()
	        		var car_data_strb=new Array()
	        		var now_date=new Date();
	        		var now_month=now_date.getMonth()
                    var now_month_h=now_month
                    var M_days_arry=new Array(31,28+my.is_leap(now_date.getFullYear()),31,30,31,30,31,31,30,31,30,31); //各月份的总天数
      	    	     //获取车辆接口start
//                  if(sessionStorage.carsList==undefined){
                    var carinfo={'u_userid':my.getCookie('id')}
    				    carinfo=JSON.stringify(carinfo)
                        carinfo=my.cryptoASEencrypt(carinfo,key).toString()
      				$.ajax({
      					url:api.userchoosecars,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':carinfo
      					},
      					error:function(){
      						    $('.ball-pulse').hide()
      							$.toast("车辆信息获取失败");
      						},
      					success:function(data){
      						$('.ball-pulse').hide()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.setCookie('token',false,-1);
      									   my.setCookie('id',false,-1);
      									   $.alert("获取失败，请重新获取",function(){
      					                   $.router.reloadPage()
      				                       });
      									   break;
      									case 50250:
      									    $.alert('请先入驻车辆',function(){
      									    	$.router.loadPage("carManger.html");
      									    });
      									    break;
      									case 50380:
      									    $.alert('没有已认证的车辆',function(){
      									    	$.router.loadPage("home.html");
      									    });
      									    break;    
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
//    								    if(data.result_state==1){
      								    	for(y=0;y<data.length;y++){
      								    	  $('.my-car-list ul').append('<li><span></span><div><a name="'+data[y].usercar_id+'">'+data[y].brand_chinese_name+'</a><br><a>'+data[y].car_plate+'</a></div><div class="clear" style="float: none;"></div></li>')
      								    	}
      								    	$('.my-car-list li').click(function(){
                        	                  $(this).siblings('li').find('span').removeClass('add_color')
                        	                  $(this).find('span').toggleClass('add_color');
                        	                  $('#select-car').empty();
                        	                  var car=$(this).find('a:first-child').text()+' '+$(this).find('a:last-child').text()
                        	                  var car_val=$(this).find('a:first-child').attr('name')
                        	                  var opt= "<option value="+car_val+" selected>"+car+"</option>"
                        	                  $('#select-car').append(opt)
                        	                  $('.for-select-car-text').text(car).css('color','#0894ec')
                        	                  $('.my-car-list').hide()
                        	                  $('.get-car-hold').hide()
                        	                  $('.cal-tab tr').not($('.cal-xq')).remove()
                        	                  car_data_stra=my.setCalendar(car_val)
                                            })
//    								    }else{
//    								    
// 	 			                                 $.alert('信息审核中...',function(){
//  	 			    	                        $.router.loadPage("home.html");
// 	 			                                 })
//
//    								    }
      								    
      							}
      					}
      				});
//    				}
//                  else{
//    							            var  data=JSON.parse(sessionStorage.carsList)
//    								    	for(y in data){
//    								    	  $('.my-car-list ul').append('<li><span></span><div><a name="'+data[y].usercar_id+'">'+data[y].brand_chinese_name+'</a><br><a>'+data[y].car_plate+'</a></div><div class="clear" style="float: none;"></div></li>')
//    								    	}
//    								    	$('.my-car-list li').click(function(){
//                      	                  $(this).siblings('li').find('span').removeClass('add_color')
//                      	                  $(this).find('span').toggleClass('add_color');
//                      	                  $('#select-car').empty();
//                      	                  var car=$(this).find('a:first').text()
//                      	                  var car_val=$(this).find('a:first').attr('name')
//                      	                  var opt= "<option value="+car_val+" selected>"+car+"</option>"
//                      	                  $('#select-car').append(opt)
//                      	                  $('.for-select-car-text').text(car)
//                      	                  $('.my-car-list').hide()
//                      	                  $('.get-car-hold').hide()
//                      	                  $('.cal-tab tr').not($('.cal-xq')).remove()
//                      	                  car_data_stra=my.setCalendar(car_val)
//                      	                  
//                                          })
//    					}
                   //   切换月份
                   
                   $('.cm-left').click(function(){
        	            if(now_month_h>0){
        	 	          now_month_h--
        	 	          $('.cal-tab tr').not($('.cal-xq')).remove()
        	              $('.now-month').text(now_month_h+1+"月")
        	              my.calendar(now_month_h,now_month,car_data_stra,car_data_strb)
        	            }
                   })
                   $('.cm-right').click(function(){
        	           if(now_month_h<11){
        	              now_month_h++
        	 	          $('.cal-tab tr').not($('.cal-xq')).remove()
        	              $('.now-month').text(now_month_h+1+"月" )
        	              my.calendar(now_month_h,now_month,car_data_stra,car_data_strb)
        	            }
                    })
                     //获取车辆接口end
                      $("#rang-time-end").datetimePicker({
		                 
                      });
                       $("#rang-time-start").datetimePicker({
                       });
//                    $("#rang-time-start,#rang-time-end").change(function(){
//                    	  byd=''
//		               	  var start=$("#rang-time-start").val()
//		                  var end=$("#rang-time-end").val()
//		                  $('[name=car_start]').val($("#rang-time-start").val())
//		                  $('[name=car_end]').val($("#rang-time-end").val())
//		                  var timespace=JSON.parse(sessionStorage.timespace)
//		                  if(timespace.length!=undefined){
//		                  	 for(t in timespace.time ){
//		                  if(start<timespace.time[t].end.substr(0,13)&&end>timespace.time[t].start.substr(0,13)){
//		                     	$.alert('车时不能包含已发布车时')
//		                     }else{
//		                     	 //初始化日历开始
//	        		        var car_data_str_key_b=0
//	    	                var start=$("#rang-time-start").val()
//		                    var end=$("#rang-time-end").val()
//  		                 if(start.substr(5,2)==end.substr(5,2))
//  		                 {
//  		                 	var len=end.substr(8,2)-start.substr(8,2)
//  		                 	var m=start.substr(8,2)
//  		                 	var e=end.substr(8,2)
//  		                 	var M=start.substr(5,2)
//  		                 	if(M.substr(0,1)==0){
//  		                 		 M=M.replace('0','')
//  		                 	}
//  		                 	if(m.substr(0,1)==0){
//  		                 		 m=m.replace('0','')
//  		                 	}
//  		                 	if(e.substr(0,1)==0){
//  		                 		   	    e=e.replace('0','')
//  		                 	}
//  		                 	if( start.substr(11)>=12&&end.substr(11)<=15){
//  		                 		byd=m+','+e
//  		                 		
//  		                 	}else if( start.substr(11)>=12&&end.substr(11)>=15){
//  		                 		byd=m
//  		                 		
//  		                 	}else if( start.substr(11)<=12&&end.substr(11)<=15){
//  		                 		byd=e
//  		                 		
//  		                 	}
//  		                 	for(var i=0;i<len;i++)
//  		                 	{    
//  		                 		var mm=+start.substr(8,2)+i
//  		                 		m+=','+(mm+1)
//  		                 	}
//  		                 	car_data_strb[car_data_str_key_b]=JSON.parse('{"'+M+'":{"yizu":['+m+'],"by":['+byd+']}}')
//  		                 }
//  		                 else
//  		                 {
//  		                 	var lena=end.substr(5,2)-start.substr(5,2)
//  		                 	for(var i=0;i<=lena;i++)
//  		                 	{
//  		                 		if(i==0){
//  		                 		var len_day_start=M_days_arry[start.substr(5,2)-1]-start.substr(8,2)//30或31需要判断
//  		                 		   var m_start=start.substr(8,2)
//  		                 		   var M=start.substr(5,2)
//  		                 	          if(M.substr(0,1)==0){
//  		                 		   	    M=M.replace('0','')
//  		                 	         }
//  		                 		   if(m_start.substr(0,1)==0){
//  		                 		   	 m_start=m_start.replace('0','')
//  		                 		   }
//  		                 		    if( start.substr(11)>=12){
//  		                 		    byd=m_start
//  		                 	        }
//  		                 		   if(len_day_start!=0){
//  		                 		   	for(var j=0;j<len_day_start;j++)
//  		                 	        {    
//  		                 		      var mm=+start.substr(8,2)+j
//  		                 		      m_start+=','+(mm+1)
//  		                 	        }
//  		                 		   }
//  		                 		
//  		                 	       car_data_str_key_b++
//  		                 	       car_data_strb[car_data_str_key_b]=JSON.parse('{"'+M+'":{"yizu":['+m_start+'],"by":['+byd+']}}')	
//  		                 		}else if(i==lena){
//  		                 		     var len_day_end=end.substr(8,2)
//  		                 	        var m_end=end.substr(8,2)
//  		                 	        var M=end.substr(5,2)
//  		                 	          if(M.substr(0,1)==0){
//  		                 		   	    M=M.replace('0','')
//  		                 	         }
//  		                 	        
//  		                 	         if(m_end.substr(0,1)==0){
//  		                 		   	    m_end=m_end.replace('0','')
//  		                 		    }
//  		                 	         if(end.substr(11)<=15){
//  		                 		      byd=m_end
//  		                 	        }
//  		                 	        for(var j=1;j<len_day_end;j++)
//  		                 	        {    
//  		                 		       var mm=+end.substr(8,2)-j
//  		                 		       m_end+=','+mm
//  		                 	        }
//  		                 	        car_data_str_key_b++
//  		                 	        car_data_strb[carse_data_str_key_b]=JSON.parse('{"'+M+'":{"yizu":['+m_end+'],"by":['+byd+']}}')
//  		                 			
//  		                 		}else{
//  		                 	        var m_len=0
//  		                 	        for(var j=1;j<=31;j++)
//  		                 	        {    
//  		                 		      m_len+=','+j
//  		                 	        }
//  		                 	        var n_m=start.substr(5,2)
//  		                 	       if(n_m.substr(0,1)==0){
//  		                 		   	    n_m=+n_m.replace('0','')+i
//  		                 		    }else{
//  		                 		    	n_m=+n_m+i
//  		                 		    }
//  		                 	        car_data_str_key_b++
//  		                 	        car_data_strb[car_data_str_key_b]=JSON.parse('{"'+n_m+'":{"yizu":['+m_len+'],"by":""}}')
//  		                 		}
//  		                 		
//  		                 	}
//  		                 	
//  		                 }
//  		                 //初始化日历结束
//                          
//                          $('.cal-tab tr').not($('.cal-xq')).remove()
//                          my.calendar(start.substr(5,2)-1,now_month,car_data_stra,car_data_strb)
//                          now_month_h=start.substr(5,2)-1
//                          if(now_month_h.toString().substr(0,1)==0){
//  		                 		 now_month_h=now_month_h.replace('0','')
//  		                 	}
//                          $('.now-month').text((now_month_h+1)+"月")  
//		                     	
//		                     }
//		                  }
//		                  
//                        
//		                  }else{
//		                  	
//		                  	 //初始化日历开始
//	        		        var car_data_str_key_b=0
//	    	               var start=$("#rang-time-start").val()
//		                  var end=$("#rang-time-end").val()
//  		                 if(start.substr(5,2)==end.substr(5,2))
//  		                 {
//  		                 	var len=end.substr(8,2)-start.substr(8,2)
//  		                 	var m=start.substr(8,2)
//  		                 	var e=end.substr(8,2)
//  		                 	var M=start.substr(5,2)
//  		                 	if(M.substr(0,1)==0){
//  		                 		 M=M.replace('0','')
//  		                 	}
//  		                 	if(m.substr(0,1)==0){
//  		                 		 m=m.replace('0','')
//  		                 	}
//  		                 	if(e.substr(0,1)==0){
//  		                 		   	    e=e.replace('0','')
//  		                 	}
//  		                 	if( start.substr(11)>=12&&end.substr(11)<=15){
//  		                 		byd=m+','+e
//  		                 		
//  		                 	}else if( start.substr(11)>=12&&end.substr(11)>=15){
//  		                 		byd=m
//  		                 		
//  		                 	}else if( start.substr(11)<=12&&end.substr(11)<=15){
//  		                 		byd=e
//  		                 		
//  		                 	}
//  		                 	for(var i=0;i<len;i++)
//  		                 	{    
//  		                 		var mm=+start.substr(8,2)+i
//  		                 		m+=','+(mm+1)
//  		                 	}
//  		                 	car_data_strb[car_data_str_key_b]=JSON.parse('{"'+M+'":{"yizu":['+m+'],"by":['+byd+']}}')
//  		                 }
//  		                 else
//  		                 {
//  		                 	var lena=end.substr(5,2)-start.substr(5,2)
//  		                 	for(var i=0;i<=lena;i++)
//  		                 	{
//  		                 		if(i==0){
//  		                 		var len_day_start=M_days_arry[start.substr(5,2)-1]-start.substr(8,2)//30或31需要判断
//  		                 		   var m_start=start.substr(8,2)
//  		                 		   var M=start.substr(5,2)
//  		                 	          if(M.substr(0,1)==0){
//  		                 		   	    M=M.replace('0','')
//  		                 	         }
//  		                 		   if(m_start.substr(0,1)==0){
//  		                 		   	 m_start=m_start.replace('0','')
//  		                 		   }
//  		                 		    if( start.substr(11)>=12){
//  		                 		    byd=m_start
//  		                 	        }
//  		                 		   if(len_day_start!=0){
//  		                 		   	for(var j=0;j<len_day_start;j++)
//  		                 	        {    
//  		                 		      var mm=+start.substr(8,2)+j
//  		                 		      m_start+=','+(mm+1)
//  		                 	        }
//  		                 		   }
//  		                 		
//  		                 	       car_data_str_key_b++
//  		                 	       car_data_strb[car_data_str_key_b]=JSON.parse('{"'+M+'":{"yizu":['+m_start+'],"by":['+byd+']}}')	
//  		                 		}else if(i==lena){
//  		                 		     var len_day_end=end.substr(8,2)
//  		                 	        var m_end=end.substr(8,2)
//  		                 	        var M=end.substr(5,2)
//  		                 	          if(M.substr(0,1)==0){
//  		                 		   	    M=M.replace('0','')
//  		                 	         }
//  		                 	        
//  		                 	         if(m_end.substr(0,1)==0){
//  		                 		   	    m_end=m_end.replace('0','')
//  		                 		    }
//  		                 	         if(end.substr(11)<=15){
//  		                 		      byd=m_end
//  		                 	        }
//  		                 	        for(var j=1;j<len_day_end;j++)
//  		                 	        {    
//  		                 		       var mm=+end.substr(8,2)-j
//  		                 		       m_end+=','+mm
//  		                 	        }
//  		                 	        car_data_str_key_b++
//  		                 	        car_data_strb[car_data_str_key_b]=JSON.parse('{"'+M+'":{"yizu":['+m_end+'],"by":['+byd+']}}')
//  		                 			
//  		                 		}else{
//  		                 	        var m_len=0
//  		                 	        for(var j=1;j<=31;j++)
//  		                 	        {    
//  		                 		      m_len+=','+j
//  		                 	        }
//  		                 	        var n_m=start.substr(5,2)
//  		                 	       if(n_m.substr(0,1)==0){
//  		                 		   	    n_m=+n_m.replace('0','')+i
//  		                 		    }else{
//  		                 		    	n_m=+n_m+i
//  		                 		    }
//  		                 	        car_data_str_key_b++
//  		                 	        car_data_strb[car_data_str_key_b]=JSON.parse('{"'+n_m+'":{"yizu":['+m_len+'],"by":""}}')
//  		                 		}
//  		                 		
//  		                 	}
//  		                 	
//  		                 }      
//                          //初始化日历结束
//                          $('.cal-tab tr').not($('.cal-xq')).remove()
//                          my.calendar(start.substr(5,2)-1,now_month,car_data_stra,car_data_strb)
//                          console.log(start+end)
//                          now_month_h=start.substr(5,2)-1
//                          if(now_month_h.toString().substr(0,1)==0){
//  		                 		 now_month_h=now_month_h.replace('0','')
//  		                 	}
//                          $('.now-month').text((now_month_h+1)+"月")  
//		                  }
//  		                 
//  		                 
//  		                 
//  		                 
//  		                 
//  		                 
//  		                 
//                    })
//      	    	   //日历结束
                        //协议选中效果
                        $('.check-yz-btn').click(function(){
                        	$.popup('.CR-xy');
                        	my.countSubmit('15','.xy-count')
                        })
                        $('.xy-no').click(function(){
                        	$('.check-xy').css('background-color','#fff').attr('name','0')
      				        clearTimeout(t)
      			         })
                        $('.xy-ok').click(function(){
                        	clearTimeout(t)
                        	$('.check-xy').css('background-color','#3C3C3C').attr('name','1')
                        })
                        //提交执行操作
                        $('#carRental-submit').click(function(){
                        	$(this).addClass('active_btn')
      				        if($('.check-xy').attr('name')=='0'){
      				        	
      				        	$.alert('请勾选并阅读车速递协议',function(){
      				        		$('#carRental-submit').removeClass('active_btn')
      				        	})
      				        	return;
      				        }
      				        $(this).addClass('active_btn')
      				        $.showPreloader();
	                        var info={
      					           u_userid:my.getCookie('id'),
      					           cars_id:$('[name=cars_id]').val(),
      					           car_start:$("#rang-time-start").val(),
      					           car_end: $("#rang-time-end").val(),
      					           park_place:$('[name=park_place]').val(),
      					           oil_cost:'1',
      					           goto_flight:$('[name=goto_flight]').val(),
      					           return_flight:$('[name=return_flight]').val(),
      					           pref_sex:$('[name=pref_sex]:checked').val(),
      					           pref_age:$('[name=pref_age]:checked').val(),
      					           pref_old:$('[name=pref_old]:checked').val(),
      					           lea_message:'',
      					           is_airportrans:'0',
      					           city_id:$('[name=city_id]').val(),
                                   airport_id: $('[name=airport_id]').val()  
      				        }
	                        console.log(info)
      				info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.userpublishcar,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      						    $('#carRental-submit').removeClass('active_btn')
      							$.toast("提交失败，请重试！");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $('#carRental-submit').removeClass('active_btn')
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
                                $.router.load(carRentalOkUrl,true);
      								    //$.router.loadPage("carRentalOk.html");
      								    
      							}
      					}
      				});
      			        })
                        //显示更多服务
                        $('#show-morefree').click(function(){
      				    $('.carRental-list-morefree').toggle()
      				     if($(this).find('img').attr('src')=='/h5car/img/icon/icon_down.png'){
      				     	$(this).find('img').attr('src','/h5car/img/icon/icon_up.png')
      				     }else{
      				     	$(this).find('img').attr('src','/h5car/img/icon/icon_down.png')
      				     }
      			        })
                        //选择服务地点开始
                     
                    $('.for-select-local').click(function(e){
      				        $.popup('.get-car');
      			         $('span[name=stu]').trigger('click')
      			        })
      			     var list=my.getStores()
	                 $('.get-car-lista span').click(function(){
		             $('.get-car-lista span').removeClass('active')
		             $(this).addClass('active')
		             var name=$(this).attr('name')
		             $('.get-car-listb span').remove()
		             $('.get-car-listb').show()
		             $('.get-car-listc,.get-car-listd,.get-car-other-box,.get-car-other-btn').hide()
		            for( k in list){
		           	if(name.match(list[k].city_spell.substr(0,1))){
				         var html="<span id='"+k+"'>"+list[k].city_name+"</span>"
				       $('.get-car-listb').prepend(html)
		              }
		            }
		            $('.get-car-listb span').click(function(){
		           	      //$('[name=brand_id]').val($(this).attr('id'))
		 	              $('.get-car-listb span').removeClass('active')
		                  $(this).addClass('active')
		                  $('.get-car-listc span').remove()
		                  $('.get-car-listc').show()
		                  $('.get-car-listd span').remove()
		                  $('.get-car-listd').hide()
		                  var j=$(this).attr('id')
		                   for(k in list[j].ji){
				               var html="<span id='"+j+"' name='"+k+"' >"+list[j].ji[k].airport_name+"</span>"
				                   $('.get-car-listc').prepend(html)
		                   }
		                   $('.get-car-listc span').click(function(){
		                   	                    //$('[name=cars_id]').val($(this).attr('name'))
		                   	                     $('.get-car-listc span').removeClass('active')
		                                         $(this).addClass('active')
		                                         $('.get-car-listd span').remove()
		                                         $('.get-car-listd').show()
		                                         var j=$(this).attr('id')
		                                         var w=$(this).attr('name')
		                                         for(k in list[j].ji[w].men){
				                                       var html="<span id='"+k+"'>"+list[j].ji[w].men[k].stores_name+"</span>"
				                                           $('.get-car-listd').prepend(html)
		                                            }
		                                          $('.get-car-listd span').click(function(){
		                                          	$('[name=park_place]').val($(this).attr('id'))
		                                          	$('[name=airport_id]').val($('.get-car-listc span.active').attr('id'))
		                                          	$('[name=city_id]').val($('.get-car-listb span.active').attr('id'))
                	                                $('.for-select-local-text').text($(this).text()).css('color','#0894ec')
                	                                $.closeModal('.get-car')
                                                  })
	                    })
	                })
              })
                        //选择汽车
                        $('#for-select-car').click(function(){
                        	$('.get-car-hold').show()
                        	$('.my-car-list').show()
                        })
                        $('.get-car-hold').click(function(){
      				       $('.my-car-list').hide();
      					   $(this).hide()
      				   })
//                      $('.my-car-list-but').click(function(){
//                      	$('.my-car-list').hide()
//                      	var input_now='';
//                      	$('#select-car').empty();
//                      	var car_length=$('.my-car-list li').length;
//                      	for(var i=0;i<car_length;i++){
//                      		if($('.my-car-list li').eq(i).find('span').hasClass('add_color')){
//                      			console.log('ok')
//                      		 var car=$('.my-car-list li').eq(i).find('a:first').text()
//                      	     var car_val=$('.my-car-list li').eq(i).find('a').attr('name')
//                      	     var opt= "<option value="+car_val+" selected>"+car+"</option>"
//                      	     $('#select-car').append(opt)
//                      	     //input_now=input_now+','+car
//                      	     input_now=car
//                      		}
//                      	} 
//                      	$('.for-select-car-text').text(input_now)
//                      	if($('.for-select-car-text').text()=='请选择汽车'||$('.for-select-car-text').text()==''){
//                      		$('.for-select-car-text').text('请选择汽车')
//                      		$.toast('请选择汽车')
//                      	}
//                      })
                    
                    //航班接口start
                    $('[name=goto_flight]').blur(function(){
                    	if($(this).val()!=''){
                    		var airinfo={
      					flight_name:$('[name=goto_flight]').val(),
      					flight_date:''
      				}
      				airinfo=my.cryptoASEencrypt(JSON.stringify(airinfo),key)
      				$.ajax({
      					url:api.searchflightinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':airinfo
      					},
      					error:function(){
      							$.toast("航班信息获取失败");
      						},
      					success:function(data){
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									  my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $('.for-select-local-text').text(data.stores[0].stores_name)
      								    $('[name=park_place]').val(data.stores[0].stores_id)
      								    var do_business_begin=data.stores[0].do_business_begin.substr(0,5)
      								    var do_business_end=data.stores[0].do_business_end.substr(0,5)
      								    $('#rang-time').mobiscroll('option', {
      								    	 invalid: [
      								     	 { start: '00:00', end: do_business_begin },
      								     	 { start: do_business_end, end: '23:59' }
      								     	 ]
   
                                         })
      								    
      							}
      					}
      				});
                    		
                    	}
                    })
})
/////////////////////////////////////////////////page_carRentalOrder//////////////////
$(document).on("pageInit", "#page_carRentalOrder", function(e, pageId, $page) {
	 key=my.get_key(my.getCookie('token'))
      	    	    var loading = false;
                    var carRentalOrderType=1
                    var pageNow=1
                    $('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()	
      	    	    var orderActiveList=my.getCarRentalOrderList(my.getCookie('id'),'','',key,1)
      	    	    console.log(orderActiveList)
//    	    	    var orderList=orderActiveList.cartime_list
//    				orderList.sort(function(x,y){
//    					return x.cartime_start.substr(0,10).replace('-','').replace('-','')-y.cartime_start.substr(0,10).replace('-','').replace('-','')
//    				})
      	    	   setTimeout(function(){
      	    	   if(orderActiveList!=''){
      	    	   	$('.carRental-order-list').empty()
      	    	   for(i=0;i<orderActiveList.cartime_list.length;i++){
      	    	   	  var list='<li id="'+orderActiveList.cartime_list[i].cartime_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_id+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cars_name+' '+orderActiveList.cartime_list[i].models_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].total_revenue+'</span><span>当前收益</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].order_count+'</span><span>订单数</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_start+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.cartime_list[i].cartime_end+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.cartime_list[i].status_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	    	
           	           $('.carRental-order-list').prepend(list)
      	    	   }
      	    	    if(orderActiveList.cartime_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	   $('.carRental-order-list li').click(function(){
      	    	   	sessionStorage.cartime_id=$(this).attr('id')
      	    	   //	$.router.loadPage("carRentalOrderDetails.html");
                       $.router.load(carRentalOrderDetailsUrl,true);
      	    	   })
      	    	   }else{
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()	
      	    	   }
      	    	   },1000)
      	    	   
      	    	   //获取行程中订单开始
      	    	   $('.orderActive').click(function(){
      	    	   	carRentalOrderType=1
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	$('.carRental-order-list').empty()
      	    	   	$('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()	
      	    	   	var orderActiveList=my.getCarRentalOrderList(my.getCookie('id'),'','',key,1)
      	    	    setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	     for(i=0;i<orderActiveList.cartime_list.length;i++){
      	    	   	  var list='<li id="'+orderActiveList.cartime_list[i].cartime_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_id+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cars_name+' '+orderActiveList.cartime_list[i].models_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].total_revenue+'</span><span>当前收益</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].order_count+'</span><span>订单数</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_start+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.cartime_list[i].cartime_end+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.cartime_list[i].status_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	    	
           	           $('.carRental-order-list').prepend(list)
      	    	     }
      	    	     if(orderActiveList.cartime_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	   $('.carRental-order-list li').click(function(){
      	    	      	sessionStorage.cartime_id=$(this).attr('id')
      	    	     	//$.router.loadPage("carRentalOrderDetails.html");
                       $.router.load(carRentalOrderDetailsUrl,true);
      	    	   })
      	    	   }else{
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()	
      	    	     	
      	    	        }
      	    	   },1000)	
      	    	   })
      	    	   //获取行程中订单结束
      	    	    //获取已完成订单开始
      	    	   $('.orderOver').click(function(){
      	    	   	carRentalOrderType=2
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	 $('.carRental-order-list').empty()
      	    	   $('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()	
      	    	   	var orderActiveList=my.getCarRentalOrderList(my.getCookie('id'),'','',key,2)
      	    	    setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	       for(i=0;i<orderActiveList.cartime_list.length;i++){
      	    	   	  var list='<li id="'+orderActiveList.cartime_list[i].cartime_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_id+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cars_name+' '+orderActiveList.cartime_list[i].models_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].total_revenue+'</span><span>当前收益</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].order_count+'</span><span>订单数</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_start+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.cartime_list[i].cartime_end+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.cartime_list[i].status_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	    	
           	           $('.carRental-order-list').prepend(list)
      	    	     }
      	    	     if(orderActiveList.cartime_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	     $('.carRental-order-list li').click(function(){
      	    	   	    sessionStorage.cartime_id=$(this).attr('id')
      	    	      	//$.router.loadPage("carRentalOrderDetails.html");
                         $.router.loadPage(carRentalOrderDetailsUrl,true);
      	    	       })
      	    	     }else{
      	    	   	  
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()	
      	    	   }
      	    	     },1000)
      	    	   	
      	    	   })
      	    	   //获取已完成订单结束
      	    	   //获取异常订单开始
      	    	   $('.orderAbnormal').click(function(){
      	    	   	carRentalOrderType=3
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	$('.carRental-order-list').empty()
      	    	   	$('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()	
      	    	   	var orderActiveList=my.getCarRentalOrderList(my.getCookie('id'),'','',key,3)
      	    	    setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	       for(i=0;i<orderActiveList.cartime_list.length;i++){
      	    	   	   var list='<li id="'+orderActiveList.cartime_list[i].cartime_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_id+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cars_name+' '+orderActiveList.cartime_list[i].models_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].total_revenue+'</span><span>当前收益</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].order_count+'</span><span>订单数</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_start+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.cartime_list[i].cartime_end+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.cartime_list[i].status_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	    	
           	           $('.carRental-order-list').prepend(list)
      	    	       }
      	    	       if(orderActiveList.cartime_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	        $('.carRental-order-list li').click(function(){
      	    	         	sessionStorage.cartime_id=$(this).attr('id')
      	    	     	   // $.router.loadPage("carRentalOrderDetails.html");
                            $.router.load(carRentalOrderDetailsUrl,true);
      	    	         })
      	    	     }else{
      	    	     	
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()	
      	    	     	
      	    	     }
      	    	   	},1000)
      	    	   })
      	    	   //获取异常订单结束
      	    	   //无限加载
      	    	    $(document).off("infinite").on("infinite", ".page-current .infinite-scroll-carRentalOrder", function() {
                    // 如果正在加载，则退出
                    if (loading) return;
                    pageNow=Math.ceil($('.page-current .carRental-order-list li').length/10+0.01)
                    console.log('pageNow:'+pageNow)
                    loading = true;
                    $('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()	
                    setTimeout(function() {
                    loading = false;
                    var orderActiveList=my.getCarRentalOrderList(my.getCookie('id'),'10',pageNow,key,carRentalOrderType)
      	    	   	if(orderActiveList!=''){
      	    	   		if(pageNow==1){
      	    	   		   $('.carRental-order-list').empty()	
      	    	   		}
      	    	   		console.log('载入条数:'+orderActiveList.cartime_list.length)
      	    	        for(i=0;i<orderActiveList.cartime_list.length;i++){
      	    	   	            var list='<li id="'+orderActiveList.cartime_list[i].cartime_id+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_id+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cars_name+' '+orderActiveList.cartime_list[i].models_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].total_revenue+'</span><span>当前收益</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].order_count+'</span><span>订单数</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.cartime_list[i].cartime_start+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.cartime_list[i].cartime_end+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.cartime_list[i].status_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	    	
           	                  $('.carRental-order-list').append(list)
      	    	     }
      	    	     if(orderActiveList.cartime_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }
      	    	     $('.carRental-order-list li').click(function(){
      	    	      	sessionStorage.cartime_id=$(this).attr('id')
      	    	     	//$.router.loadPage("carRentalOrderDetails.html");
                         $.router.load(carRentalOrderDetailsUrl,true);
      	    	     })
      	    	     }else{
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
      	    	     	$('.infiniteOver').show()
      	    	     }
                   }, 1000);
               });
});
/////////////////////////////////////////////////page_carRentalOrderDetails//////////////////
$(document).on("pageInit", "#page_carRentalOrderDetails", function(e, pageId, $page) {
	              $('.CROD-xc-toggle').click(function(){
						 $('.CROD-xc').toggle()
			      })
      			 //车时详情开始
      			    key=my.get_key(my.getCookie('token'))
      			    $.showPreloader()
      			    var car_start //车时开始时间
                    var car_end //车时结束时间
                    var store_id //门店编号
                    var user_id //用户编号
                    var cars_id //车辆编号
                    var info_carRentalOrderDetails={cartime_id:sessionStorage.cartime_id}
                        info_carRentalOrderDetails=my.cryptoASEencrypt(JSON.stringify(info_carRentalOrderDetails),key)
      				
      				$.ajax({
      					url:api.listcartimeinfo,
      					type: 'post',
      					async:false,
      					data:{
      						'api_value':info_carRentalOrderDetails
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("车时详情获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    car_start=data.info.cartime_start.substr(0,16) //车时开始时间
                                        car_end=data.info.cartime_end.substr(0,16)//车时结束时间
                                        store_id=data.info.parking_place //门店编号
                                        user_id=data.info.user_id //用户编号
                                        cars_id=data.info.usercar_id //车辆编号
                                        if(data.info.change_state==0){
                                        	$('.xgcs-carRentalOrder').hide()
                                        }else if(data.info.change_state==1){
                                        	$('.xgcs-carRentalOrder').show()
                                        }
                                        if(data.info.cancel_state==0){
                                        	$('.qxcs-carRentalOrder').hide()
                                        }else if(data.info.cancel_state==1){
                                        	$('.qxcs-carRentalOrder').show()
                                        }
                                        $('.usercar_nickname').text(data.info.usercar_nickname)
                                        $('.models_name').text(data.info.models_name)
      								    $('.stores_name').text(data.info.stores_name)
      								    $('.cartime_start').text(data.info.cartime_start)
      								    $('.cartime_end').text(data.info.cartime_end)
      								    //循环输出定单开始
      								    if(data.order_count!=0){
      								      for(var i=0;i<data.order_list.length;i++){
      								    	var list='<div class="CROD-yc CROD-yc-head carRentalOrderList-head " style=" margin-bottom:0"><span>'+config.danwei+data.order_list[i].order_income+'</span><a>'
      								    	         +data.order_list[i].state_dec+'</a><div class="clear"></div></div><div class="CROD-yc-head-main carRentalOrderList-main" >' 
		 	                                         +'<div class="CROD-yc"><a>开始时间</a><span class="rent_begin_time">'+data.order_list[i].rent_begin_time.substr(0,16)+'</span><div class="clear"></div></div>'
		 	                                         +'<div class="CROD-yc"><a>结束时间</a><span class="rent_end_time">'+data.order_list[i].rent_end_time.substr(0,16)+'</span><div class="clear"></div></div>'
		 	                                         +'<div class="CROD-yc"><a>定单金额</a><span class="order_income">'+config.danwei+data.order_list[i].order_income+'</span><div class="clear"></div></div>'
		 	                                         +'<div class="CROD-yc"><a>订单状态</a><span class="state_dec">'+data.order_list[i].state_dec+'</span><div class="clear"></div></div>'
		 	                                         +'<div class="CROD-yc"><a>到账收益</a><span class="fact_income">'+data.order_list[i].fact_income+'</span><div class="clear"></div></div>'
//                                                   +'<div class="CROD-yc" id="'+data.order_list[i].order_id+'" style="text-align: center;"><div class="bottn">取消订单</div></div>'
                                                     +'</div>'
                                            $('.carRentalOrderList').prepend(list)
		 	                                }
      								      $('.CROD-yc-head').click(function(){
      	    	   	                            $('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
						                         $(this).next('.CROD-yc-head-main').toggle()
				                          }) 
      								    }
      								    //循环输出定单结束
      								    //验车状态开始
      								    if(data.info.givecar_state==1){
      								    	$('.yczt-xskz').show()
      								    	$('.givecar_state').show()
      								    	
      								    }else if(data.info.givecar_state==0){
      								    	$('.yczt-xskz').hide()
      								    	$('.givecar_state').hide()
      								    }
      								    if(data.info.getcar_state==1){
      								    	
      								    	$('.getcar_state').show()
      								    	
      								    }else if(data.info.getcar_state==0){
      								    	
      								    	$('.getcar_state').hide()
      								    }
      								    //取车验车点击
                                        $('.givecar_state').click(function(){
                    	                       sessionStorage.yctypeCarRental=1
                    	                  // $.router.loadPage("carRentalOrderGiveCar.html");
                                            $.router.load(carRentalOrderGiveCarUrl,true);
                                        })
                                        $('.getcar_state').click(function(){
                    	                       sessionStorage.yctypeCarRental=4
                    	                  // $.router.loadPage("carRentalOrderGetCar.html");
                                            $.router.load(carRentalOrderGetCarUrl,true);
                                         })
      								    //验车状态结束
      						}
      					}
      				})
                      //车时详情结束
                      //修改车时开始
                       if(my.parserDate(car_start)>new Date())
                       {
                       	console.log('可以修改')
                      var cal_start_Y=car_start.substr(0,4)
                      var cal_start_M=car_start.substr(5,2)-1
                      var cal_start_D=car_start.substr(8,2)
                      var cal_start_H=car_start.substr(11,2)
                      var cal_end_Y=car_end.substr(0,4)
                      var cal_end_M=car_end.substr(5,2)-1
                      var cal_end_D=car_end.substr(8,2)
                      var cal_end_H=car_end.substr(11,2)
                      var now=new Date();
                       $(".xgcs-carRentalOrder-start").datetimePicker({
                            value: [cal_start_Y,cal_start_M+1, cal_start_D, cal_start_H, '00'],
                       })
                       $(".xgcs-carRentalOrder-end").datetimePicker({
                            value: [cal_end_Y,cal_end_M+1, cal_end_D, cal_end_H, '00'],
                            onClose:function(){
                         	   $.confirm('确认修改？', function () {
		               	    var info={
      					       cartime_id:sessionStorage.cartime_id,
      					       car_start:$(".xgcs-carRentalOrder-start").val(),
      					       car_end:$(".xgcs-carRentalOrder-end").val(),
      					       store_id:store_id,
      					       user_id:user_id,
      					       cars_id:cars_id
      				           }
		               	         console.log(info)
		                       $.showPreloader()
      				            info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				            $.ajax({
      					url:api.upusercartime,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.alert("修改车时失败，请重新修改");
      						},
      				    complete:function(){
      				    	$(".xgcs-carRentalOrder-start").val('修改车时开始时间')
      				    	$(".xgcs-carRentalOrder-end").val('修改车时结束时间')
      				    },
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								}     
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $.alert('修改成功')
      								   
      							        
      							}
      					}
      				});
		               	  
                         	   },function(){
                         	          	  $(".xgcs-carRentalOrder-start").val('修改车时开始时间')
      				    	              $(".xgcs-carRentalOrder-end").val('修改车时结束时间') 
                         	          }
                         	   )
                         	}
                      });
                       }else{
                       	     console.log('不可以修改')
                       	     $(".xgcs-carRentalOrder-start").hide()
                       	     var cal_end_Y=car_end.substr(0,4)
                             var cal_end_M=car_end.substr(5,2)-1
                             var cal_end_D=car_end.substr(8,2)
                             var cal_end_H=car_end.substr(11,2)
                             $(".xgcs-carRentalOrder-end").datetimePicker({
                                  value: [cal_end_Y,cal_end_M+1, cal_end_D, cal_end_H, '00'],
                                  onClose:function(){
                         	              $.confirm('确认修改？', function () {
                         	              	  var start=car_start
		                     var end=$(".xgcs-carRentalOrder-end").val()
		               	     var info={
      					     cartime_id:sessionStorage.cartime_id,
      					     car_start:start,
      					     car_end:end,
      					     store_id:store_id,
      					     user_id:user_id,
      					     cars_id:cars_id
      				       }
		               	   console.log(info)
		            $.showPreloader()
      				info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.upusercartime,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					complete:function(){
      				    	$(".xgcs-carRentalOrder-start").val('修改车时开始时间')
      				    	$(".xgcs-carRentalOrder-end").val('修改车时结束时间')
      				    },
      					error:function(){
      						    $.hidePreloader()
      							$.alert("修改车时失败，请重新修改");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg);
      								}     
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $.alert('修改成功')
      								   
      							        
      							}
      					}
      				}); 
                         	             },function(){
      				             	$(".xgcs-carRentalOrder-end").val('修改车时结束时间') 
                             })
                         	          }
                             })
                       	    
                       }
                      $(".xgcs-carRentalOrder-start").val('修改车时开始时间')
      				    	$(".xgcs-carRentalOrder-end").val('修改车时结束时间') 
                        //修改过车时结束
                           //下拉刷新start
      		    $(document).on('refresh', '.pull-to-refresh-content-carRentalOrderDetails',function() {
      		    	var info_carRentalOrderDetails={cartime_id:sessionStorage.cartime_id}
                        info_carRentalOrderDetails=my.cryptoASEencrypt(JSON.stringify(info_carRentalOrderDetails),key)
      				
      				$.ajax({
      					url:api.listcartimeinfo,
      					type: 'post',
      					async:false,
      					data:{
      						'api_value':info_carRentalOrderDetails
      					},
      					error:function(){
      						    $.hidePreloader()
      						    $.pullToRefreshDone('.pull-to-refresh-content')
      							$.toast("车时详情获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						$.pullToRefreshDone('.pull-to-refresh-content')
      						if(data.match("err_code")!=null){
      							
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    car_start=data.info.cartime_start //车时开始时间
                                        car_end=data.info.cartime_end//车时结束时间
                                        store_id=data.info.parking_place //门店编号
                                        user_id=data.info.user_id //用户编号
                                        cars_id=data.info.usercar_id //车辆编号
                                        $('.usercar_nickname').text(data.info.usercar_nickname)
                                        $('.models_name').text(data.info.models_name)
      								    $('.stores_name').text(data.info.stores_name)
      								    $('.cartime_start').text(data.info.cartime_start)
      								    $('.cartime_end').text(data.info.cartime_end)
      								    //循环输出定单开始
      								    if(data.order_count!=0){
      								      $('.carRentalOrderList').empty()
      								      for(var i=0;i<data.order_list.length;i++){
      								    	var list='<div class="CROD-yc CROD-yc-head carRentalOrderList-head " style=" margin-bottom:0"><span>RMB: '+data.order_list[i].order_income+'</span><a>'
      								    	         +data.order_list[i].state_dec+'</a><div class="clear"></div></div><div class="CROD-yc-head-main carRentalOrderList-main" >' 
		 	                                         +'<div class="CROD-yc"><a>开始时间</a><span class="rent_begin_time">'+data.order_list[i].rent_begin_time+'</span><div class="clear"></div></div>'
		 	                                         +'<div class="CROD-yc"><a>结束时间</a><span class="rent_end_time">'+data.order_list[i].rent_end_time+'</span><div class="clear"></div></div>'
		 	                                         +'<div class="CROD-yc"><a>定单金额</a><span class="order_income">'+data.order_list[i].order_income+'</span><div class="clear"></div></div>'
		 	                                         +'<div class="CROD-yc"><a>订单状态</a><span class="state_dec">'+data.order_list[i].state_dec+'</span><div class="clear"></div></div>'
		 	                                         +'<div class="CROD-yc"><a>到账收益</a><span class="fact_income">'+data.order_list[i].fact_income+'</span><div class="clear"></div></div>'
//                                                   +'<div class="CROD-yc" id="'+data.order_list[i].order_id+'" style="text-align: center;"><div class="bottn">取消订单</div></div>'
                                                     +'</div>'
                                            $('.carRentalOrderList').prepend(list)
		 	                                }
      								      $('.CROD-yc-head').click(function(){
      	    	   	                            $('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
						                         $(this).next('.CROD-yc-head-main').toggle()
				                          }) 
      								    }
      								    //循环输出定单结束
      								    //验车状态开始
      								    if(data.info.givecar_state==1){
      								    	$('.yczt-xskz').show()
      								    	$('.givecar_state').show()
      								    	
      								    }else if(data.info.givecar_state==0){
      								    	$('.yczt-xskz').hide()
      								    	$('.givecar_state').hide()
      								    }
      								    if(data.info.getcar_state==1){
      								    	
      								    	$('.getcar_state').show()
      								    	
      								    }else if(data.info.getcar_state==0){
      								    	
      								    	$('.getcar_state').hide()
      								    }
      								    //取车验车点击
                                        $('.givecar_state').click(function(){
                    	                       sessionStorage.yctypeCarRental=1
                    	                   //$.router.loadPage("carRentalOrderGiveCar.html");
                                            $.router.load(carRentalOrderGiveCarUrl,true);
                                        })
                                        $('.getcar_state').click(function(){
                    	                       sessionStorage.yctypeCarRental=4
                    	                   //$.router.loadPage("carRentalOrderGetCar.html");
                                            $.router.load(carRentalOrderGetCarUrl,true);
                                         })
      								    //验车状态结束
      						}
      					}
      				})
      		    })
      		    //下拉刷新结束
      		    //取消车时开始
      		    $('.qxcs-carRentalOrder').click(function(){
      		    	$('.qxcs-carRentalOrder').addClass('active_btn')
      		    	 var info={
      					cartime_id:sessionStorage.cartime_id,
      					user_id:user_id,
      				}
      		    	console.log(info)
		            $.showPreloader()
      				info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.usercancelcartime,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      						    $('.qxcs-carRentalOrder').removeClass('active_btn')
      							$.toast("取消车时失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $('.qxcs-carRentalOrder').removeClass('active_btn')
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $.alert('取消成功',function(){
      								       //$.router.loadPage("carRentalOrder.html");
                                            $.router.load(carRentalOrderUrl,true);
                                        })
      								   
      							        
      							}
      					}
      				});
      		    })
      		    //取消车时结束
})
/////////////////////////////////page_carRentalOrderGetCar//////////////////////////////
$(document).on("pageInit", "#page_carRentalOrderGetCar", function(e, pageId, $page) {
	                 $.showPreloader()
      			    key=my.get_key(my.getCookie('token'))
					//获取信息开始
					var info_yc={
      					order_id:sessionStorage.cartime_id,
      					type:sessionStorage.yctypeCarRental
      			    }
      				info_yc=my.cryptoASEencrypt(JSON.stringify(info_yc),key)
      				$.ajax({
      					url:api.viewcheckcar,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_yc
      					},
      					error:function(){
      							$.toast("获取失败，请点击重新获取");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								 data=JSON.parse(data)
      								 data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      							     if(data.info[0].sure_state==1){
      							     	$('.CCD-btn').hide()
      							     }
      							     workorder_id=data.info[0].workorder_id
      							     workstep_id=data.info[0].workstep_id
      							     $('.CCD-dl span').eq(-1).text(data.info[0].manage_fullname)
      							     $('.hc-yb').text(data.info[0].fuel_meter)
      							     $('.cha-yb').text(data.info[0].fuelmeter_diff)
      							     $('.qc-yb').text(data.info[0].fuelmeter_get)
      							     $('.hc-gl').text(data.info[0].mileage_data+'公里')
      							     $('.qc-gl').text(data.info[0].mileagedata_diff+'公里')
      							     $('.cha-gl').text(data.info[0].mileagedata_get+'公里')
      							     for(var i=0;i<data.img.length;i++){
      							     	switch(+data.img[i].checkcarimg_type)
      								    {
      									case 1:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-ycd').text(data.img[i].check_remarks)}
      									   break;
      									case 3:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-lcyb').text(data.img[i].check_remarks)}
      									   break;
      									case 4:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-lcyb').text(data.img[i].check_remarks)}
      									   break;
      									case 2:
      									   $('.swiper-b').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-b').text(data.img[i].check_remarks)}
      									   break;
//    									case 5:
//    									   $('.swiper-c').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
//    									   if(data.img[i].check_remarks!='')
//    									    {$('.bz-c').text(data.img[i].check_remarks)}
//    									   break;
      								    } 
      							     }
      							     for(var i=0;i<data.damage.length;i++){
      							     	var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: 1rem;"><span>车损项目</span><span>'+data.damage[i].damage_item+'</span></div>'
      							     	         +'<div class="table-head-a"><span>车损状况</span><span>'+data.damage[i].status_dec+'</span></div>'
      							                 +'<div class="table-head-a"><span>预估维修费</span><span>'+data.damage[i].damage_cost+'</span></div>'
      							                 +'<div class="table-head-a"><span>登记时间</span><span>'+data.damage[i].damage_time+'</span></div>'
      							                 +'<div class="table-head-a"><span>车损部位</span><span>'+data.damage[i].option_dec+'</span></div>' 
      							                 +'<div class="table-head-a"><span>处理意见</span><span>'+data.damage[i].damage_deal+'</span></div>'
      							                 +'<div class="table-head-a"><span>车损确认费用</span><span>'+data.damage[i].cost+'</span></div>'
      							               $('.qc_damage_list').append(list)
      							     }
      							     var mySwiper = new Swiper('.CD-swiper',{
                                        pagination : '.swiper-pagination',
                                       })
      							}
      					}
      				})
					//获取信息结束
					//确认验车开始
					$('.CCD-btn').click(function(){
						$.showPreloader()
						var info_ycok={
      					workorder_id:workorder_id,
      					workstep_id:workstep_id,
      					manage_id:my.getCookie('id')
      			        }
      				   info_ycok=my.cryptoASEencrypt(JSON.stringify(info_ycok),key)
      				$.ajax({
      					url:api.stepscomplete,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_ycok
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("提交失败，请重新提交");
      						},
      					success:function(data){
      						$.hidePreloader()
      						$.alert('验车成功',function(){
      						//	$.router.loadPage("carRentalOrderDetails.html");
                                $.router.load(carRentalOrderDetailsUrl,true);
      						})
      						
      					}
					    })
      		        })
					//确认验车结束
})
////////////////////////////////page_carRentalOrderGiveCar/////////////////////////////////
$(document).on("pageInit", "#page_carRentalOrderGiveCar", function(e, pageId, $page) {
	                $.showPreloader()
      			    key=my.get_key(my.getCookie('token'))
					//获取信息开始
					var info_yc={
      					order_id:sessionStorage.cartime_id,
      					type:sessionStorage.yctypeCarRental
      			    }
      				info_yc=my.cryptoASEencrypt(JSON.stringify(info_yc),key)
      				$.ajax({
      					url:api.viewcheckcar,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_yc
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("获取失败，请点击重新获取");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								 data=JSON.parse(data)
      								 data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      							     console.log(data)
      							     if(data.info[0].sure_state==1){
      							     	$('.CCD-btn').hide()
      							     }
      							     workorder_id=data.info[0].workorder_id
      							     workstep_id=data.info[0].workstep_id
      							     $('.CCD-dl span').eq(-1).text(data.info[0].manage_fullname)
      							     $('.qc-yb').text(data.info[0].fuel_meter)
      							     $('.qc-gl').text(data.info[0].mileage_data+'公里')
      							     for(var i=0;i<data.img.length;i++){
      							     	switch(+data.img[i].checkcarimg_type)
      								    {
      									case 1:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-ycd').text(data.img[i].check_remarks)}
      									   break;
      									case 3:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-lcyb').text(data.img[i].check_remarks)}
      									   break;
      									case 4:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-lcyb').text(data.img[i].check_remarks)}
      									   break;
      									case 2:
      									   $('.swiper-b').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-b').text(data.img[i].check_remarks)}
      									   break;
//    									case 5:
//    									   $('.swiper-c').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
//    									   if(data.img[i].check_remarks!='')
//    									    {$('.bz-c').text(data.img[i].check_remarks)}
//    									   break;
      								    } 
      							     }
      							     for(var i=0;i<data.damage.length;i++){
      							     	var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: 1rem;"><span>车损项目</span><span>'+data.damage[i].damage_item+'</span></div>'
      							     	         +'<div class="table-head-a"><span>车损状况</span><span>'+data.damage[i].status_dec+'</span></div>'
      							                 +'<div class="table-head-a"><span>预估维修费</span><span>'+data.damage[i].damage_cost+'</span></div>'
      							                 +'<div class="table-head-a"><span>登记时间</span><span>'+data.damage[i].damage_time+'</span></div>'
      							                 +'<div class="table-head-a"><span>车损部位</span><span>'+data.damage[i].option_dec+'</span></div>' 
      							                 +'<div class="table-head-a"><span>处理意见</span><span>'+data.damage[i].damage_deal+'</span></div>'
      							                 +'<div class="table-head-a"><span>车损确认费用</span><span>'+data.damage[i].cost+'</span></div>'
      							               $('.qc_damage_list').append(list)
      							     }
      							     var mySwiper = new Swiper('.CD-swiper',{
                                        pagination : '.swiper-pagination',
                                       })
      							}
      					}
      				})
					//获取信息结束
					//确认验车开始
					$('.CCD-btn').click(function(){
						$.showPreloader()
						var info_ycok={
      					workorder_id:workorder_id,
      					workstep_id:workstep_id,
      					manage_id:my.getCookie('id')
      			        }
      				   info_ycok=my.cryptoASEencrypt(JSON.stringify(info_ycok),key)
      				$.ajax({
      					url:api.stepscomplete,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_ycok
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("提交失败，请重新提交");
      						},
      					success:function(data){
      						$.hidePreloader()
      						$.alert('验车成功',function(){
      							//$.router.loadPage("carRentalOrderDetails.html");
                                $.router.load(carRentalOrderDetailsUrl,true);
      						})
      						
      					}
					    })
      		        })
					//确认验车结束
})
/////////////////////////////////////////////////////page_rentalCarOrder////////////////////////
$(document).on("pageInit", "#page_rentalCarOrder", function(e, pageId, $page) {
      	    	   $('.infinite-scroll-preloader').show();
                   $('.infiniteOver').hide()
      	    	   key=my.get_key(my.getCookie('token'))
      	    	   var loading = false;
                   var RentalOrderType=1
                   var pageNow=1
                   var orderActiveList=my.getRentalCarOrderList(my.getCookie('id'),'','',key,1)
                    setTimeout(function(){
      	    	   if(orderActiveList!=''){
      	    	   	$('.order-list-rentalCar').empty()
      	    	    for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	  var list='<li id="'+orderActiveList.order_list[i].rental_orderid+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].rental_ordernum+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].order_startime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].order_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'
           	    	
           	           $('.order-list-rentalCar').prepend(list)
      	    	   }
      	    	    if(orderActiveList.order_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	   $('.order-list-rentalCar li').click(function(){
      	    	   	sessionStorage.orderid=$(this).attr('id')
      	    	   //	$.router.loadPage("rentalCarOrderDetails.html");
                       $.router.load(rentalCarOrderDetailsUrl,true);
      	    	   })
      	    	   }else{
      	    	   	    $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	   }
      	    	   },1000);
      	    	   
      	    	   //获取行程中订单开始
      	    	   $('.orderActive').click(function(){
      	    	   	RentalOrderType=1
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	$('.order-list-rentalCar').empty()
      	    	   	$('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()
      	    	   	var orderActiveList=my.getRentalCarOrderList(my.getCookie('id'),'','',key,1)
      	    	   	setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	      for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	     var list='<li id="'+orderActiveList.order_list[i].rental_orderid+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].rental_ordernum+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].order_startime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.order_list[i].order_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	            
           	    	            $('.order-list-rentalCar').prepend(list)
      	    	       }
      	    	      if(orderActiveList.order_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	       $('.order-list-rentalCar li').click(function(){
      	    	   	     sessionStorage.orderid=$(this).attr('id')
      	    	   	     //$.router.loadPage("rentalCarOrderDetails.html");
                           $.router.load(rentalCarOrderDetailsUrl,true);
      	    	       })
      	    	     }else{
      	    	   	    $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	   }
      	    	     },1000);
      	    	   	
      	    	   })
      	    	   //获取行程中订单结束
      	    	    //获取已完成订单开始
      	    	   $('.orderOver').click(function(){
      	    	   	RentalOrderType=2
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	$('.order-list-rentalCar').empty()
      	    	   	$('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()
      	    	   	var orderActiveList=my.getRentalCarOrderList(my.getCookie('id'),'','',key,2)
      	    	   	setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	      for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	     var list='<li id="'+orderActiveList.order_list[i].rental_orderid+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].rental_ordernum+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].order_startime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.order_list[i].order_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'   
           	    	            $('.order-list-rentalCar').prepend(list)
      	    	       }
      	    	      if(orderActiveList.order_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	      $('.order-list-rentalCar li').click(function(){
      	    	   	     sessionStorage.orderid=$(this).attr('id')
      	    	   	     //$.router.loadPage("rentalCarOrderDetails.html");
                          $.router.load(rentalCarOrderDetailsUrl,true);
      	    	       })
      	    	     }else{
      	    	     	
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()	
      	    	     	
      	    	   	    
      	    	   }
      	    	     },1000)
      	    	   	
      	    	   })
      	    	   //获取已完成订单结束
      	    	   //获取异常订单开始
      	    	   $('.orderAbnormal').click(function(){
      	    	   	RentalOrderType=3
      	    	   	pageNow=1
      	    	   	$(this).siblings('span').removeClass('active')
      	    	   	$(this).addClass('active')
      	    	   	$('.order-list-rentalCar').empty()
      	    	   	$('.infinite-scroll-preloader').show();
                    $('.infiniteOver').hide()
      	    	   	var orderActiveList=my.getRentalCarOrderList(my.getCookie('id'),'','',key,3)
      	    	   	setTimeout(function(){
      	    	   	if(orderActiveList!=''){
      	    	      for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	     var list='<li id="'+orderActiveList.order_list[i].rental_orderid+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].rental_ordernum+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].order_startime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.order_list[i].order_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	      
           	    	            $('.order-list-rentalCar').prepend(list)
      	    	       }
      	    	      if(orderActiveList.order_list.length<10){
      	    	        $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }else{
      	    	     	 $.attachInfiniteScroll($('.infinite-scroll'));
                         $('.infinite-scroll-preloader').show();
                         $('.infiniteOver').hide()
      	    	     }
      	    	      $('.order-list-rentalCar li').click(function(){
      	    	   	     sessionStorage.orderid=$(this).attr('id')
      	    	   	   //  $.router.loadPage("rentalCarOrderDetails.html");
                          $.router.load(rentalCarOrderDetailsUrl,true);
      	    	       })
      	    	     }else{
      	    	   	    $.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	   }
      	    	     },1000);
      	    	   	
      	    	   })
      	    	   //获取异常订单结束
      	    	   //无限加载
      	    	    $(document).off("infinite").on("infinite", ".page-current .infinite-scroll-rentalCarOrder", function() {
                    // 如果正在加载，则退出
                    if (loading) return;
                    pageNow=Math.ceil($('.page-current .order-list-rentalCar li').length/10+0.01)
                    console.log('pageNow:'+pageNow)
                    console.log('类型id:'+RentalOrderType)
                    loading = true;
                    setTimeout(function() {
                    loading = false;
                    var orderActiveList=my.getRentalCarOrderList(my.getCookie('id'),'10',pageNow,key,RentalOrderType)
      	    	   	if(orderActiveList!=''){
      	    	   		if(pageNow==1){
      	    	   		   $('.order-list-rentalCar').empty()	
      	    	   		}
      	    	   		console.log('载入条数:'+orderActiveList.order_list.length)
      	    	        for(i=0;i<orderActiveList.order_list.length;i++){
      	    	   	            var list='<li id="'+orderActiveList.order_list[i].rental_orderid+'"><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].rental_ordernum+'</span><span>车时编号</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].brand_chinese_name+' '+orderActiveList.order_list[i].cars_name+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].car_plate+'</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].stores_name+'</span><span>原地还车</span></div><div class="carR-ok-b"><span>'
           	    	            +orderActiveList.order_list[i].order_startime+'</span><span>开始时间</span></div><div class="carR-ok-b"><span>'
                                +orderActiveList.order_list[i].order_endtime+'</span><span>结束时间</span></div><div class="carR-ok-b order-list-more"><span>'
           	    	            +orderActiveList.order_list[i].state_dec+'<img src="/h5car/img/icon/sj.png"></span></div></li>'           	      
           	    	            $('.order-list-rentalCar').append(list)
      	    	       }
      	    	       if(orderActiveList.order_list.length<10){
      	    	           $.detachInfiniteScroll($('.infinite-scroll'));
                           $('.infinite-scroll-preloader').hide();
                           $('.infiniteOver').show()
      	    	       }
      	    	       $('.order-list-rentalCar li').click(function(){
      	    	      	  sessionStorage.orderid=$(this).attr('id')
      	    	     	//  $.router.loadPage("rentalCarOrderDetails.html");
                           $.router.load(rentalCarOrderDetailsUrl,true);
      	    	       })
      	    	     }else{
      	    	     	$.detachInfiniteScroll($('.infinite-scroll'));
                        $('.infinite-scroll-preloader').hide();
                        $('.infiniteOver').show()
      	    	     }
                   }, 2000);
               });
});
///////////////////////////////page_rentalCarOrderDetails//////////////////////
$(document).on("pageInit", "#page_rentalCarOrderDetails", function(e, pageId, $page) {
	$.showPreloader()
      			    key=my.get_key(my.getCookie('token'))
      			    var car_place=''
      			    var start_time=''
      			    var end_time=''
      			    var user_carid=''
      	    	    $('.CROD-xc-toggle').click(function(){
						$('.CROD-xc').toggle()
					})
      	    	     //订单详情开始
                    var info={order_id:sessionStorage.orderid}
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.userorderinfo,
      					type: 'post',
      					async:false,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("订单详情获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    user_carid=data.info.usercar_id
      								    car_place=data.info.parking_place
      								    start_time=data.info.order_startime
      								    end_time=data.info.order_endtime
      								    $('.clxhh').text(data.info.brand_chinese_name+''+data.info.cars_name)
      								    $('.usercar_nickname').text(data.info.usercar_nickname)
      								    $('.stores_name').text(data.info.stores_name)
      								    $('.order_startime').text(data.info.order_startime.substr(0,16))
      								    $('.order_endtime').text(data.info.order_endtime.substr(0,16))
      								    $('.workday_price').text(config.danwei+data.info.workday_price+' * '+data.info.workday_num)
      								    $('.weekend_price').text(config.danwei+data.info.weekend_price+' * '+data.info.weekend_num)
      								    $('.holiday_price').text(config.danwei+data.info.holiday_price+' * '+data.info.holiday_num)
      								    $('.store_private_price').text(config.danwei+data.info.store_private_price)
      								    $('.limit_carid_price').text(config.danwei+data.info.limit_carid_price+' * '+data.info.limit_num)
      								    $('.weixiu_total').text(config.danwei+data.info.weixiu_total)
      								    $('.weizhang_total').text(config.danwei+data.info.weizhang_total)
      								    $('.insurance_price').text(config.danwei+data.info.insurance_price+' * '+data.info.insurance_num)
      								    $('.weiyue_total').text(config.danwei+data.info.weiyue_total)
      								    $('.ewai_total').text(config.danwei+data.info.ewai_total)
      								    $('.order_total').text(config.danwei+data.info.order_total)
      								    for(v in data.flow){
      								    	var step='<div id="'+v+'"><span>'+data.flow[v]+'</span><img src="/h5car/img/icon/zjt.png"></div>'
      								    	$('.CROD-xc-rentalCalOrderDetails').append(step)
      								    }
      								    $('.map_stores_name').text(data.info.stores_name)
      								    $('.map_stores_name_re').text(data.info.stores_name_re)
      								    $('.qc-url').attr('href',picmapUrl+'?baidu_longitude='+data.info.baidu_longitude+'&baidu_atitude='+data.info.baidu_atitude+'&stores_phone='+data.info.stores_phone+'&stores_address='+escape(data.info.stores_address)+'&stores_name='+escape(data.info.stores_name))
      								    $('.hc-url').attr('href',picmapUrl+'?baidu_longitude='+data.info.baidu_longitude_re+'&baidu_atitude='+data.info.baidu_atitude_re+'&stores_phone='+data.info.stores_phone_re+'&stores_address='+escape(data.info.stores_address_re)+'&stores_name='+escape(data.info.stores_name_re))
      								    $('#'+data.info.now_id).css('color','#000')
      								    if(data.info.order_state>=8){
      								    	$('.xgcs').hide()
      								    }else{
      								    	$('.xgcs').show()
      								    }
      								    if(data.info.order_state>=6){
      								    	$('.qxdd').hide()
      								    }else{
      								    	$('.qxdd').show()
      								    }
//    								    if(data.info.waitfp_status==0){
//    								    	$('.waitfp_status').text('待支付订单预定 '+data.info.waitfp_cost+config.danwei).attr('id',data.info.waitfp_id)
//    								    	$('.waitfp_status').on('click',function(){
//    								    		sessionStorage.waitfp_cost=data.info.waitfp_cost
//    								    		sessionStorage.waitfp_id=$(this).attr('id')
//                  	                        $.router.loadPage("zhifu_other.html");
//    								    	})
//    								    }else if(data.info.waitfp_status==1){
//    								    	$('.waitfp_status').text('已支付订单预定 '+data.info.waitfp_cost+config.danwei).removeClass('btn-zf').attr('id',data.info.waitfp_id)
//    								    	$('.waitfp_status').on('click',function(){
//    								    		sessionStorage.waitfp_id=$(this).attr('id')
//    								    		sessionStorage.ewtype=4
//                  	                        $.router.loadPage("otherCostdetails.html");
//    								    	})
//    								    }
      								    if(data.info.orderyajin_show==1){
      								    	if(data.info.is_depositpay==1){
      								    	     $('.orderyajin_show').show().text('已支付订单押金'+config.danwei+data.info.order_deposit).removeClass('btn-zf')
      								    	     $('.orderyajin_show').click(function(){
      								    	     	sessionStorage.yjtype=1
      								                $.router.loadPage("depositCostDetails.html")
      								    	    })
      								    	 }else if(data.info.is_depositpay==0){
      								    	 	 $('.orderyajin_show').show().text('待支付订单押金'+config.danwei+data.info.order_deposit).addClass('btn-zf')
      								    	     $('.orderyajin_show').click(function(){
                    	                            sessionStorage.zftype=1
                    	                            //$.router.loadPage("zhifu_yajin.html");
                                                     $.router.load(zhifuyajinUrl,true);
                                                  })
      								    	 }
      								    	
      								    }else if(data.info.orderyajin_show==0){
      								    	$('.orderyajin_show').hide()
      								    }
      								    if(data.info.weizhang_show==1){
      								    	if(data.info.is_legalpay==1){
      								    	     $('.weizhang_show').show().text('已支付违章押金'+config.danwei+data.info.legal_deposit).removeClass('btn-zf')
      								    	     $('.weizhang_show').click(function(){
      								    	     	sessionStorage.yjtype=2
      								                $.router.loadPage("depositCostDetails.html")
      								    	    })
      								    	 }else if(data.info.is_legalpay==0){
      								    	 	 $('.weizhang_show').show().text('待支付违章押金'+config.danwei+data.info.legal_deposit).addClass('btn-zf')
      								    	     $('.weizhang_show').click(function(){
                    	                         sessionStorage.zftype=2
                    	                            //$.router.loadPage("zhifu_yajin.html");
                                                     $.router.load(zhifuyajinUrl,true);
                                                  })
      								    	 }
      								    	
      								    }else if(data.info.weizhang_show==0){
      								    	$('.weizhang_show').hide()
      								    }
      								    if(data.info.quche_state==1){
      								    	
      								    	$('.quche_state').show()
      								    	
      								    }else if(data.info.quche_state==0){
      								    	
      								    	$('.quche_state').hide()
      								    	//$('.quche_state').attr('href','carCheckDetails.html').addClass('btn-zf')
      								    }
      								    if(data.info.huanche_state==1){
      								    	$('.huanche_state').show()
      								    }else if(data.info.huanche_state==0){
      								    	
      								    	$('.huanche_state').hide()
      								    	//$('.huanche_state').attr('href','carCheckDetails.html').addClass('btn-zf')
      								    }
      								    if(data.info.zhifu_count!=0){
      								    	$('.zf-btn-list').empty()
      								    	for(var i=0;i<data.zhifu_button.length;i++){
      								    		if(data.zhifu_button[i].waitfp_status==0){
      								    			var list='<div class="zfxm-zf bottn btn-zf" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'" title="'+data.zhifu_button[i].waitfp_cost+'">待支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}else if(data.zhifu_button[i].waitfp_status==1)
      								    		{
      								    			var list='<div class="zfxm-xq bottn" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'">已支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}
      								    	}
      								    	$('.zfxm-zf').click(function(){
      								    		sessionStorage.waitfp_id=$(this).attr('id')
      								    		sessionStorage.waitfp_cost=$(this).attr('title')
                    	                        //$.router.loadPage("zhifu_other.html");
                                                $.router.load(zhifu_otherUrl,true);
      								    	})
      								    	$('.zfxm-xq').click(function(){
      								    		sessionStorage.ewtype=4
      								    		sessionStorage.waitfp_id=$(this).attr('id')
                                                $.router.loadPage(otherCostdetailsUrl,true)
      								    		//$.router.loadPage("otherCostdetails.html")
                    	                        //$.router.loadPage("zhifu_other.html");
      								    	})
      								    }
      								    
      								    
      						}
      					}
      				})
                    //订单详情结束
                    //取车验车点击
                    $('.quche_state').click(function(){
                    	sessionStorage.yctype=2
                    	//$.router.loadPage("carCheckDetailsQuche.html");
                        $.router.loadPage(carCheckDetailsQucheUrl,true);
                    })
                    $('.huanche_state').click(function(){
                    	sessionStorage.yctype=3
                    	//$.router.loadPage("carCheckDetailsHuanche.html");
                        $.router.loadPage(carCheckDetailsHuancheUrl,true);
                    })
      	    	    //修改车时开始
                     var cal_end_Y=end_time.substr(0,4)
                     var cal_end_M=end_time.substr(5,2)-1
                     var cal_end_D=end_time.substr(8,2)
                     var cal_end_H=end_time.substr(11,2)
                     $("#rang-time").datetimePicker({
                            value: [cal_end_Y,cal_end_M+1,cal_end_D,cal_end_H,'00'],
                            onClose:function(){
                            	 $.confirm('确认修改？',
                                 function () {
                                    var info={
      					order_id:sessionStorage.orderid,
      					user_carid:user_carid,
      					car_place:car_place,
      					start_time:start_time,
      					new_endtime: $("#rang-time").val(),
      				}
                                    console.log(info)
		            $.showPreloader()
      				info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.uporderrentdate,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("修改租期失败，请重新修改");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								    data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $.alert('修改成功')
      								   
      							        
      							}
      					}
      				});
                                 },
                                 function () {
                                     $("#rang-time").val('修改租期结束时间')
                                 }
                                 );
                            }
                           
                     });
   	    	   $("#rang-time").val('修改租期结束时间')
      	    	    //修改过车时结束
      	    	    //取消订单开始
      	    	    $('.qxdd').click(function(){
      	    	       $.confirm('确认要取消么？',function(){
      	    	       	$.showPreloader()
      	    	    $('.qxdd').addClass('active_btn')
                    var info_del={
                    	        order_id:sessionStorage.orderid,
                    	        user_id:my.getCookie('id')
                            }
                        info_del=my.cryptoASEencrypt(JSON.stringify(info_del),key)
                       
      				$.ajax({
      					url:api.usercancelorder,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_del
      					},
      					error:function(){
      						    $.hidePreloader()
      						    $('.qxdd').removeClass('active_btn')
      							$.toast("订单取消失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						$('.qxdd').removeClass('active_btn')
      						$.alert('取消成功',function(){
      						//	$.router.loadPage("rentalCarOrder.html");
                                $.router.loadPage(rentalCarOrderUrl,true);
      						})
      					}
      				  })
      	    	    	
      	    	       })
      	    	    
      			    })
      	    	    //取消订单结束
      	    	     //下拉刷新start
      		    $(document).on('refresh', '.pull-to-refresh-content-rentalCarOrderDetails',function() {
      		    	 //订单详情开始
      		    	  $("#rang-time").val('修改租期结束时间')
                    var info={order_id:sessionStorage.orderid}
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				$.ajax({
      					url:api.userorderinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info
      					},
      					error:function(){
      						    $.hidePreloader()
      						    $.pullToRefreshDone('.pull-to-refresh-content');
      							$.toast("订单详情获取失败");
      						},
      					success:function(data){
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							$.pullToRefreshDone('.pull-to-refresh-content');
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        $.hidePreloader()
      							        $.pullToRefreshDone('.pull-to-refresh-content');
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								    user_carid=data.info.usercar_id
      								    car_place=data.info.parking_place
      								    start_time=data.info.order_startime
      								    $('.clxhh').text(data.info.brand_chinese_name+''+data.info.cars_name)
      								    $('.usercar_nickname').text(data.info.usercar_nickname)
      								    $('.stores_name').text(data.info.stores_name)
      								    $('.order_startime').text(data.info.order_startime)
      								    $('.order_endtime').text(data.info.order_endtime)
      								    $('.workday_price').text(config.danwei+data.info.workday_price+' * '+data.info.workday_num)
      								    $('.weekend_price').text(config.danwei+data.info.weekend_price+' * '+data.info.weekend_num)
      								    $('.holiday_price').text(config.danwei+data.info.holiday_price+' * '+data.info.holiday_num)
      								    $('.store_private_price').text(config.danwei+data.info.store_private_price)
      								    $('.limit_carid_price').text(config.danwei+data.info.limit_carid_price+' * '+data.info.limit_num)
      								    $('.weixiu_total').text(config.danwei+data.info.weixiu_total)
      								    $('.weizhang_total').text(config.danwei+data.info.weizhang_total)
      								    $('.insurance_price').text(config.danwei+data.info.insurance_price+' * '+data.info.insurance_num)
      								    $('.weiyue_total').text(config.danwei+data.info.weiyue_total)
      								    $('.ewai_total').text(config.danwei+data.info.ewai_total)
      								    $('.order_total').text(config.danwei+data.info.order_total)
      								    if(data.info.order_state>=8){
      								    	$('.xgcs').hide()
      								    }else{
      								    	$('.xgcs').show()
      								    }
      								    if(data.info.order_state>=6){
      								    	$('.qxdd').hide()
      								    }else{
      								    	$('.qxdd').show()
      								    }
      								    console.log(data.info.waitfp_status)
//    								    if(data.info.waitfp_status==0){
//    								    	$('.waitfp_status').text('待支付订单预定 '+config.danwei+data.info.waitfp_cost).attr('id',data.info.waitfp_id)
//    								    	$('.waitfp_status').on('click',function(){
//    								    		sessionStorage.waitfp_id=$(this).attr('id')
//                  	                        $.router.loadPage("zhifu_other.html");
//    								    	})
//    								    }else if(data.info.waitfp_status==1){
//
//    								    	$('.waitfp_status').text('已支付订单预定 '+config.danwei+data.info.waitfp_cost).removeClass('btn-zf').attr('id',data.info.waitfp_id)
//    								    	$('.waitfp_status').on('click',function(){
//    								    		sessionStorage.waitfp_id=$(this).attr('id')
//    								    		sessionStorage.ewtype=4
//                  	                        $.router.loadPage("otherCostdetails.html");
//    								    	})
//    								    }
      								    if(data.info.orderyajin_show==1){
      								    	if(data.info.is_depositpay==1){
      								    	     $('.orderyajin_show').show().text('已支付订单押金'+config.danwei+data.info.order_deposit).removeClass('btn-zf')
      								    	     $('.orderyajin_show').click(function(){
      								              $.toast('订单押金详情');
      								    	    })
      								    	 }else if(data.info.is_depositpay==0){
      								    	 	 $('.orderyajin_show').show().text('待支付订单押金'+config.danwei+data.info.order_deposit).addClass('btn-zf')
      								    	     $('.orderyajin_show').click(function(){
                    	                            sessionStorage.zftype=1
                    	                            //$.router.loadPage("zhifu_yajin.html");
                                                     $.router.load(zhifuyajinUrl,true);
                                                  })
      								    	 }
      								    	
      								    }else if(data.info.orderyajin_show==0){
      								    	$('.orderyajin_show').hide()
      								    }
      								    if(data.info.weizhang_show==1){
      								    	if(data.info.is_legalpay==1){
      								    	     $('.weizhang_show').show().text('已支付违章押金'+config.danwei+data.info.legal_deposit).removeClass('btn-zf')
      								    	     $('.weizhang_show').click(function(){
      								              $.toast('违章押金详情');
      								    	    })
      								    	 }else if(data.info.is_legalpay==0){
      								    	 	 $('.weizhang_show').show().text('待支付违章押金'+config.danwei+data.info.legal_deposit).addClass('btn-zf')
      								    	     $('.weizhang_show').click(function(){
                    	                             sessionStorage.zftype=2
                    	                          //  $.router.loadPage("zhifu_yajin.html");
                                                     $.router.load(zhifuyajinUrl,true);
                                                  })
      								    	 }
      								    	
      								    }else if(data.info.weizhang_show==0){
      								    	$('.weizhang_show').hide()
      								    }
      								    if(data.info.quche_state==1){
      								    	
      								    	$('.quche_state').show()
      								    	
      								    }else if(data.info.quche_state==0){
      								    	
      								    	$('.quche_state').hide()
      								    	//$('.quche_state').attr('href','carCheckDetails.html').addClass('btn-zf')
      								    }
      								    if(data.info.huanche_state==1){
      								    	$('.huanche_state').show()
      								    }else if(data.info.huanche_state==0){
      								    	
      								    	$('.huanche_state').hide()
      								    	//$('.huanche_state').attr('href','carCheckDetails.html').addClass('btn-zf')
      								    }
      								    if(data.info.zhifu_count!=0){
      								    	$('.zf-btn-list div').not('.waitfp_status').remove()
      								    	for(var i=0;i<data.zhifu_button.length;i++){
      								    		if(data.zhifu_button[i].waitfp_status==0){
      								    			var list='<div class="zfxm-zf bottn btn-zf" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'">待支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}else if(data.zhifu_button[i].waitfp_status==1)
      								    		{
      								    			var list='<div class="zfxm-xq bottn" style="margin-top: 1rem;" id="'+data.zhifu_button[i].waitfp_id+'">已支付  '+config.danwei+data.zhifu_button[i].waitfp_cost+'</div>'
      								    			$('.zf-btn-list').append(list)
      								    		}
      								    	}
      								    	$('.zfxm-zf').click(function(){
      								    		sessionStorage.waitfp_id=$(this).attr('id')
                    	                       // $.router.loadPage("zhifu_other.html");
                                                $.router.load(zhifu_otherUrl,true);
      								    	})
      								    	$('.zfxm-xq').click(function(){
      								    		sessionStorage.waitfp_id=$(this).attr('id')
      								    		sessionStorage.ewtype=4
                    	                        //$.router.loadPage("otherCostdetails.html");
                                                $.router.load(otherCostdetailsUrl,true);
      								    	})
      								    }
      								    
      								    
      						}
      					}
      				})
                    //订单详情结束
                });//下拉刷新end
                //租金保险
                $('.CROD-yc-head-zjbx').click(function(){
      	    	   	    $('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
						$(this).next('.CROD-yc-head-main').toggle()
				    })
                 //维修费用开始
                $('.CROD-yc-head-wxfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')=='block'){
				    		 //$.showPreloader()
				          $('.table-head-main-wxfy').siblings('.fyxq').show()
      					  $('.table-head-main-wxfy').siblings('.fyxq-no').hide()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:5
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				    $.ajax({
      					  url:api.orderweixiuselect,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    //$.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	//$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							 setTimeout(function() {
      							 	$('.table-head-main-wxfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-wxfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-wxfy').empty()
      							$('.table-head-main-wxfy').siblings('.fyxq').hide()
      							for(var i=0;i<data.list.length;i++){
      							  var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>车损项目</span><span>'+data.list[i].damage_item+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车损状况</span><span>'+data.list[i].damage_status+'</span></div>'
		 	                              +'<div class="table-head-a"><span>预估维修费</span><span>'+config.danwei+data.list[i].cost+'</span></div>'
		 	                               +'<div class="table-head-a"><span>时间</span><span>'+data.list[i].damage_time+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].remark+'</span></div>'
		 	                      
		 	                      $('.table-head-main-wxfy').append(list)
		 	                    }
      						}
      					  }
      						}
      				    })
                		    
                	   }
				    })
                 //维修费用结束
                 //违章费用开始
                $('.CROD-yc-head-wzfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
                	$(this).next('.CROD-yc-head-main').toggle()
				   // $(this).next('.CROD-yc-head-main').toggle("normal",function(){
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		// $.showPreloader()
				    	  $('.table-head-main-wzfy').siblings('.fyxq').show()
      					  $('.table-head-main-wzfy').siblings('.fyxq-no').hide()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:5
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectweiz,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							 setTimeout(function() {
      							 	$('.table-head-main-wzfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-wzfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-wzfy').empty()
      							$('.table-head-main-wzfy').siblings('.fyxq').hide()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违法行为代码</span><span>'+data.list[i].legal_code+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车辆牌照</span><span>'+data.list[i].car_plate+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法时间</span><span>'+data.list[i].legal_date.substr(0,16)+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法地点</span><span>'+data.list[i].legal_address+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法金额</span><span>'+config.danwei+data.list[i].legal_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].legal_remark+'</span></div>'
		 	                      $('.table-head-main-wzfy').append(list)
		 	                    }
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    }) 
                 //违章费用结束
                 //违约费用开始
                $('.CROD-yc-head-wyfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		 //$.showPreloader()
				    		  $('.table-head-main-wyfy').siblings('.fyxq').show()
      					  $('.table-head-main-wyfy').siblings('.fyxq-no').hide()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:5
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectweiy,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							 setTimeout(function() {
      							 	$('.table-head-main-wyfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-wyfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-wyfy').empty()
      							$('.table-head-main-wyfy').siblings('.fyxq').hide()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违约类型</span><span>'+data.list[i].rental_type+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约时间</span><span>'+data.list[i].breach_date.substr(0,16)+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约金</span><span>'+config.danwei+data.list[i].breach_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约方</span><span>'+data.list[i].breach_owner+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].breach_remark+'</span></div>'
		 	                      console.log(list)
		 	                      $('.table-head-main-wyfy').append(list)
		 	                    }
      						}
      						}
      					  }
      				    })
                		    
                	   }
				  
                }) //违约费用结束
                //额外费用开始
                $('.CROD-yc-head-ewxm').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		// $.showPreloader()
				    		 $('.table-head-main-ewxm').siblings('.fyxq').show()
      					  $('.table-head-main-ewxm').siblings('.fyxq-no').hide()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:5
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectewai,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							 setTimeout(function() {
      							 	$('.table-head-main-ewxm').siblings('.fyxq').hide()
      							 	$('.table-head-main-ewxm').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-ewxm').empty()
      							$('.table-head-main-ewxm').siblings('.fyxq').hide()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>项目名</span><span>'+data.list[i].item_name+'</span></div>'
		 	                              +'<div class="table-head-a"><span>费用</span><span>'+config.danwei+data.list[i].item_cost+'</span></div>'
		 	                              +'<div class="table-head-a"><span>创建时间</span><span>'+data.list[i].item_date.substr(0,16)+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].Remark+'</span></div>'
		 	                      $('.table-head-main-ewxm').append(list)
		 	                    }
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    
                }) //额外费用结束
})
///////////////////////////////////////////page_carCheckDetailsQuche////////////////////////
$(document).on("pageInit", "#page_carCheckDetailsQuche", function(e, pageId, $page) {
	$.showPreloader()
      			    key=my.get_key(my.getCookie('token'))
					//获取信息开始
					var info_yc={
      					order_id:sessionStorage.orderid,
      					type:sessionStorage.yctype
      			    }
      				info_yc=my.cryptoASEencrypt(JSON.stringify(info_yc),key)
      				$.ajax({
      					url:api.viewcheckcar,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_yc
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("获取失败，请刷新重试");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								 data=JSON.parse(data)
      								 data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      							     if(data.info[0].sure_state==1){
      							     	$('.CCD-btn').hide()
      							     }
      							     workorder_id=data.info[0].workorder_id
      							     workstep_id=data.info[0].workstep_id
      							     $('.CCD-dl span').eq(-1).text(data.info[0].manage_fullname)
      							     $('.qc-yb').text(data.info[0].fuel_meter)
      							     $('.qc-gl').text(data.info[0].mileage_data+'公里')
      							     for(var i=0;i<data.img.length;i++){
      							     	switch(+data.img[i].checkcarimg_type)
      								    {
      									case 1:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-ycd').text(data.img[i].check_remarks)}
      									   break;
      									case 3:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-lcyb').text(data.img[i].check_remarks)}
      									   break;
      									case 4:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-lcyb').text(data.img[i].check_remarks)}
      									   break;
      									case 2:
      									   $('.swiper-b').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-b').text(data.img[i].check_remarks)}
      									   break;
//    									case 5:
//    									   $('.swiper-c').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
//    									   if(data.img[i].check_remarks!='')
//    									    {$('.bz-c').text(data.img[i].check_remarks)}
//    									   break;
      								    } 
      							     }
      							     for(var i=0;i<data.damage.length;i++){
      							     	var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: 1rem;"><span>车损项目</span><span>'+data.damage[i].damage_item+'</span></div>'
      							     	         +'<div class="table-head-a"><span>车损状况</span><span>'+data.damage[i].status_dec+'</span></div>'
      							                 +'<div class="table-head-a"><span>预估维修费</span><span>'+data.damage[i].damage_cost+'</span></div>'
      							                 +'<div class="table-head-a"><span>登记时间</span><span>'+data.damage[i].damage_time+'</span></div>'
      							                 +'<div class="table-head-a"><span>车损部位</span><span>'+data.damage[i].option_dec+'</span></div>' 
      							                 +'<div class="table-head-a"><span>处理意见</span><span>'+data.damage[i].damage_deal+'</span></div>'
      							                 +'<div class="table-head-a"><span>车损确认费用</span><span>'+data.damage[i].cost+'</span></div>'
      							               $('.qc_damage_list').append(list)
      							     }
      							     var mySwiper = new Swiper('.CD-swiper',{
                                        pagination : '.swiper-pagination',
                                       })
      							}
      					}
      				})
					//获取信息结束
					//确认验车开始
					$('.CCD-btn').click(function(){
						$.showPreloader()
						var info_ycok={
      					workorder_id:workorder_id,
      					workstep_id:workstep_id,
      					manage_id:my.getCookie('id')
      			        }
      				   info_ycok=my.cryptoASEencrypt(JSON.stringify(info_ycok),key)
      				$.ajax({
      					url:api.stepscomplete,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_ycok
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("提交失败，请重新提交");
      						},
      					success:function(data){
      						$.hidePreloader()
      						$.alert('验车成功',function(){
      							//$.router.loadPage(" rentalCarOrderDetails.html	");
                                $.router.load(rentalCarOrderDetailsUrl,true);
      						})
      						
      					}
					    })
      		        })
					//确认验车结束
})
/////////////////////////////////////////////page_carCheckDetailsHuanche/////////////////////////////
$(document).on("pageInit", "#page_carCheckDetailsHuanche", function(e, pageId, $page) {
	$.showPreloader()
      			    key=my.get_key(my.getCookie('token'))
					//获取信息开始
					var info_yc={
      					order_id:sessionStorage.orderid,
      					type:sessionStorage.yctype
      			    }
      				info_yc=my.cryptoASEencrypt(JSON.stringify(info_yc),key)
      				$.ajax({
      					url:api.viewcheckcar,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_yc
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("获取失败，请点击重新获取");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      							}else{
      								 data=JSON.parse(data)
      								 data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      							     if(data.info[0].sure_state==1){
      							     	$('.CCD-btn').hide()
      							     }
      							     workorder_id=data.info[0].workorder_id
      							     workstep_id=data.info[0].workstep_id
      							     $('.CCD-dl span').eq(-1).text(data.info[0].manage_fullname)
      							     $('.hc-yb').text(data.info[0].fuel_meter)
      							     $('.cha-yb').text(data.info[0].fuelmeter_diff)
      							     $('.qc-yb').text(data.info[0].fuelmeter_get)
      							     $('.hc-gl').text(data.info[0].mileage_data+'公里')
      							     $('.qc-gl').text(data.info[0].mileagedata_diff+'公里')
      							     $('.cha-gl').text(data.info[0].mileagedata_get+'公里')
      							     for(var i=0;i<data.img.length;i++){
      							     	switch(+data.img[i].checkcarimg_type)
      								    {
      									case 1:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-ycd').text(data.img[i].check_remarks)}
      									   break;
      									case 3:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-lcyb').text(data.img[i].check_remarks)}
      									   break;
      									case 4:
      									   $('.swiper-a').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-a-lcyb').text(data.img[i].check_remarks)}
      									   break;
      									case 2:
      									   $('.swiper-b').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
      									   if(data.img[i].check_remarks!='')
      									    {$('.bz-b').text(data.img[i].check_remarks)}
      									   break;
//    									case 5:
//    									   $('.swiper-c').append('<div class="swiper-slide"><img src="'+config.url+data.img[i].checkcar_img +'"></div>')
//    									   if(data.img[i].check_remarks!='')
//    									    {$('.bz-c').text(data.img[i].check_remarks)}
//    									   break;
      								    } 
      							     }
      							     for(var i=0;i<data.damage.length;i++){
      							     	var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: 1rem;"><span>车损项目</span><span>'+data.damage[i].damage_item+'</span></div>'
      							     	         +'<div class="table-head-a"><span>车损状况</span><span>'+data.damage[i].status_dec+'</span></div>'
      							                 +'<div class="table-head-a"><span>预估维修费</span><span>'+data.damage[i].damage_cost+'</span></div>'
      							                 +'<div class="table-head-a"><span>登记时间</span><span>'+data.damage[i].damage_time+'</span></div>'
      							                 +'<div class="table-head-a"><span>车损部位</span><span>'+data.damage[i].option_dec+'</span></div>' 
      							                 +'<div class="table-head-a"><span>处理意见</span><span>'+data.damage[i].damage_deal+'</span></div>'
      							                 +'<div class="table-head-a"><span>车损确认费用</span><span>'+data.damage[i].cost+'</span></div>'
      							               $('.qc_damage_list').append(list)
      							     }
      							     var mySwiper = new Swiper('.CD-swiper',{
                                        pagination : '.swiper-pagination',
                                       })
      							}
      					}
      				})
					//获取信息结束
					//确认验车开始
					$('.CCD-btn').click(function(){
						$.showPreloader()
						var info_ycok={
      					workorder_id:workorder_id,
      					workstep_id:workstep_id,
      					manage_id:my.getCookie('id')
      			        }
      				   info_ycok=my.cryptoASEencrypt(JSON.stringify(info_ycok),key)
      				    $.ajax({
      					url:api.stepscomplete,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_ycok
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("提交失败，请重新提交");
      						},
      					success:function(data){
      						$.hidePreloader()
      						$.alert('验车成功',function(){
      							//$.router.loadPage(" rentalCarOrderDetails.html");
                                $.router.load(rentalCarOrderDetailsUrl,true);
      						})
      						
      					}
					    })
      		        })
					//确认验车结束
})
///////////////////////////////////////page_otherCostdetails/////////////////////////
$(document).on("pageInit", "#page_otherCostdetails", function(e, pageId, $page) {
	key=my.get_key(my.getCookie('token'))
      	    	     //待付详情开始
      	    	    $.showPreloader()
                    var info_df={
                    	 waitfp_id:sessionStorage.waitfp_id,
                    	 type:sessionStorage.ewtype
                    }
                        info_df=my.cryptoASEencrypt(JSON.stringify(info_df),key)
      				$.ajax({
      					url:api.waitpayinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_df
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("待付详情获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $('.waitfp_id').text(data.waitfp_id)
      								    $('.channel_dec').text(data.channel_dec)
      								    $('.createdate').text(data.createdate)
      								    $('.payment_balance').text(config.danwei+data.payment_balance)
      								    $('.payment_cost').text(config.danwei+data.payment_cost)
      								    $('.payment_readycost').text(config.danwei+data.payment_readycost)
      								    $('.payment_volume').text(config.danwei+data.payment_volume)
      							 }
      								    
      								    
      						}
      					})
      				//维修费用开始
                $('.CROD-yc-head-ew-wxfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		// $.showPreloader()
				    		 $('.table-head-main-ew-wxfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-ew-wxfy').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.waitfp_id,
                    	        type:sessionStorage.ewtype
                            }
                          console.log(info)
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderweixiuselect,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wxfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-ew-wxfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							$('.table-head-main-ew-wxfy').empty()
      							for(var i=0;i<data.list.length;i++){
      							     var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>车损项目</span><span>'+data.list[i].damage_item+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车损状况</span><span>'+data.list[i].damage_status+'</span></div>'
		 	                              +'<div class="table-head-a"><span>预估维修费</span><span>'+config.danwei+data.list[i].cost+'</span></div>'
		 	                               +'<div class="table-head-a"><span>时间</span><span>'+data.list[i].damage_time+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].remark+'</span></div>'
		 	                      
		 	                      $('.table-head-main-ew-wxfy').append(list)
		 	                    }
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    })
                 //维修费用结束
                 //违章费用开始
                $('.CROD-yc-head-ew-wzfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		 $('.table-head-main-ew-wzfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-ew-wzfy').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.waitfp_id,
                    	        type:sessionStorage.ewtype
                           }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectweiz,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wzfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-ew-wzfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wzfy').siblings('.fyxq').hide()
      							$('.table-head-main-ew-wzfy').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违法行为代码</span><span>'+data.list[i].legal_code+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车辆牌照</span><span>'+data.list[i].car_plate+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法时间</span><span>'+data.list[i].legal_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法地点</span><span>'+data.list[i].legal_address+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法金额</span><span>'+config.danwei+data.list[i].legal_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].legal_remark+'</span></div>'
		 	                      $('.table-head-main-ew-wzfy').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				   
                }) //违章费用结束
                 //违约费用开始
                $('.CROD-yc-head-ew-wyfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		  $('.table-head-main-ew-wyfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-ew-wyfy').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.waitfp_id,
                    	        type:sessionStorage.ewtype
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectweiy,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wyfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-ew-wyfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-ew-wyfy').siblings('.fyxq').hide()
      							$('.table-head-main-ew-wyfy').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违约类型</span><span>'+data.list[i].rental_type+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约时间</span><span>'+data.list[i].breach_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约金</span><span>'+config.danwei+data.list[i].breach_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约方</span><span>'+data.list[i].breach_owner+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].breach_remark+'</span></div>'
		 	                        $('.table-head-main-ew-wyfy').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				   
                }) //违约费用结束
                //额外费用开始
                $('.CROD-yc-head-ew-ewxm').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		 $('.table-head-main-ew-ewxm').siblings('.fyxq-no').hide()
				    		  $('.table-head-main-ew-ewxm').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.waitfp_id,
                    	        type:sessionStorage.ewtype
                            }
                          console.log(info)
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectewai,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-ew-ewxm').siblings('.fyxq').hide()
      							 	$('.table-head-main-ew-ewxm').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-ew-ewxm').siblings('.fyxq').hide()
      							$('.table-head-main-ew-ewxm').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>项目名</span><span>'+data.list[i].item_name+'</span></div>'
		 	                              +'<div class="table-head-a"><span>费用</span><span>'+config.danwei+data.list[i].item_cost+'</span></div>'
		 	                              +'<div class="table-head-a"><span>创建时间</span><span>'+data.list[i].item_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].remark+'</span></div>'
		 	                      $('.table-head-main-ew-ewxm').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    
                }) //额外费用结束
})
////////////////////////page_depositCostDetails//////////////////////////
$(document).on("pageInit", "#page_depositCostDetails", function(e, pageId, $page) {
	$.showPreloader()
      			    key=my.get_key(my.getCookie('token'))
      	    	    $('.CROD-xc-toggle').click(function(){
						$('.CROD-xc').toggle()
					})
                    var info_yajin={
                    	        order_id:sessionStorage.orderid,
                    	        type:sessionStorage.yjtype
                        }
                        console.log(info_yajin)
                        info_yajin=my.cryptoASEencrypt(JSON.stringify(info_yajin),key)
      				$.ajax({
      					url:api.depositinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_yajin
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("押金详情获取失败");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							$.hidePreloader()
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    $('.credit_cost').text(config.danwei+data.info.credit_cost)
      								    $('.payment_cost').text(config.danwei+data.info.payment_cost)
      								    for(v in data.flow){
      								    	var step='<div id="'+v+'"><span>'+data.flow[v]+'</span><img src="/h5car/img/icon/zjt.png"></div>'
      								    	$('.CROD-xc-yajin').append(step)
      								    }
      								    
      								    $('#'+data.info.now_id).css('color','#000')
      								   
      							 }
      								    
      								    
      						}
      					})
                 //维修费用开始
                $('.CROD-yc-head-yajin-wxfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		 $('.table-head-main-yajin-wxfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-yajin-wxfy').siblings('.fyxq').show()
				    		 //$.showPreloader()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:sessionStorage.yjtype
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderweixiuselect,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    //$.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	//$.hidePreloader()
      					  	
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-yajin-wxfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-yajin-wxfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-yajin-wxfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-yajin-wxfy').empty()
      							    for(var i=0;i<data.list.length;i++){
      							        var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>车损项目</span><span>'+data.list[i].damage_item+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车损状况</span><span>'+data.list[i].damage_status+'</span></div>'
		 	                              +'<div class="table-head-a"><span>预估维修费</span><span>'+config.danwei+data.list[i].cost+'</span></div>'
		 	                               +'<div class="table-head-a"><span>时间</span><span>'+data.list[i].damage_time+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].remark+'</span></div>'
		 	                      
		 	                          $('.table-head-main-yajin-wxfy').append(list)
		 	                        }
      							 }, 1000);
      							
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    })
                 //维修费用结束
                 //违章费用开始
                $('.CROD-yc-head-yajin-wzfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		  $('.table-head-main-yajin-wzfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-yajin-wzfy').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:sessionStorage.yjtype
                           }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectweiz,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						console.log(data)
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-yajin-wzfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-yajin-wzfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-yajin-wzfy').siblings('.fyxq').hide()
      							$('.table-head-main-yajin-wzfy').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违法行为代码</span><span>'+data.list[i].legal_code+'</span></div>'
		 	                              +'<div class="table-head-a"><span>车辆牌照</span><span>'+data.list[i].car_plate+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法时间</span><span>'+data.list[i].legal_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法地点</span><span>'+data.list[i].legal_address+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违法金额</span><span>'+config.danwei+data.list[i].legal_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].legal_remark+'</span></div>'
		 	                      $('.table-head-main-yajin-wzfy').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    })
                //违章费用结束
                 //违约费用开始
                $('.CROD-yc-head-yajin-wyfy').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		  $('.table-head-main-yajin-wyfy').siblings('.fyxq-no').hide()
				    		 $('.table-head-main-yajin-wyfy').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:sessionStorage.yjtype
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectweiy,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-yajin-wyfy').siblings('.fyxq').hide()
      							 	$('.table-head-main-yajin-wyfy').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-yajin-wyfy').siblings('.fyxq').hide()
      							$('.table-head-main-yajin-wyfy').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>违约类型</span><span>'+data.list[i].rental_type+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约时间</span><span>'+data.list[i].breach_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约金</span><span>'+config.danwei+data.list[i].breach_cash+'</span></div>'
		 	                              +'<div class="table-head-a"><span>违约方</span><span>'+data.list[i].breach_owner+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].breach_remark+'</span></div>'
		 	                        $('.table-head-main-yajin-wyfy').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				    })
                //违约费用结束
                //额外费用开始
                $('.CROD-yc-head-yajin-ewxm').click(function(){
                	$('.CROD-yc-head-main').not($(this).next('.CROD-yc-head-main')).hide()
				    $(this).next('.CROD-yc-head-main').toggle()
				    	if($(this).next('.CROD-yc-head-main').css('display')!='none'){
				    		  $('.table-head-main-yajin-ewxm').siblings('.fyxq-no').hide()
				    		  $('.table-head-main-yajin-ewxm').siblings('.fyxq').show()
                          var info={
                    	        order_id:sessionStorage.orderid,
                    	        type:sessionStorage.yjtype
                            }
                        info=my.cryptoASEencrypt(JSON.stringify(info),key)
                       
      				    $.ajax({
      					  url:api.orderselectewai,
      					  type: 'post',
      					  async:true,
      					  data:{
      						'api_value':info
      					  },
      					  error:function(){
      						    $.hidePreloader()
      							$.toast("获取详情失败");
      						},
      					  success:function(data){
      					  	$.hidePreloader()
      					  	if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      						data=JSON.parse(data)
                            data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      						if(data.list.length==0){
      							setTimeout(function() {
      							 	$('.table-head-main-yajin-ewxm').siblings('.fyxq').hide()
      							 	$('.table-head-main-yajin-ewxm').siblings('.fyxq-no').show()
      							 }, 1000);
      						}else{
      							setTimeout(function() {
      							 	$('.table-head-main-yajin-ewxm').siblings('.fyxq').hide()
      							$('.table-head-main-yajin-ewxm').empty()
      							for(var i=0;i<data.list.length;i++){
      							   var list='<div class="table-head-a" style="border-top: solid thin #ccc;margin-top: .5rem;"><span>项目名</span><span>'+data.list[i].item_name+'</span></div>'
		 	                              +'<div class="table-head-a"><span>费用</span><span>'+config.danwei+data.list[i].item_cost+'</span></div>'
		 	                              +'<div class="table-head-a"><span>创建时间</span><span>'+data.list[i].item_date+'</span></div>'
		 	                              +'<div class="table-head-a"><span style="width: 100%;">备注：'+data.list[i].remark+'</span></div>'
		 	                      $('.table-head-main-yajin-ewxm').append(list)
		 	                    }
      							},1000);
      						}
      						}
      					  }
      				    })
                		    
                	   }
				   
                }) //额外费用结束
})
//////////////////////////////////////////////////////////////////ORDER/////////////////////////////////////////


///////////////////////////////////////////////////RENTALCAR ///////////////////////////////
/////////////////////////page_rentalCar///////////////////
$(document).on("pageInit", "#page_rentalCar", function(e, pageId, $page) {
      	    	         key=my.get_key(my.getCookie('token'))
      	    	          var carListsort=''
      	    	          var loading = false;
                          var pageNow=1
                  //获取时间范围开始
                     var timeinfo={
      					u_userid:my.getCookie('id'),
      					}
      				timeinfo=my.cryptoASEencrypt(JSON.stringify(timeinfo),key)
      				$.ajax({
      					url:api.usercartimeinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':timeinfo
      					},
      					error:function(){
      						    $('.ball-pulse').hide()
      							$.toast("时间范围获取失败");
      						},
      					success:function(data){
      						if(data.match("err_code")!=null){	
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									case 50390:
      									    $.alert('请确认是否泊车成功',function(){
      									     window.location.href="home.html"
      									    });
      									    break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      									   $.router.loadPage("home.html");
      								}     
      						}else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
      								     var cal_start_Y=data[0].cartime_start.substr(0,4)
                                         var cal_start_M=data[0].cartime_start.substr(5,2)-1
                                         var cal_start_D=data[0].cartime_start.substr(8,2)
                                         var cal_start_H=data[0].cartime_start.substr(11,2)
                                         var cal_end_Y=data[0].cartime_end.substr(0,4)
                                         var cal_end_M=data[0].cartime_end.substr(5,2)-1
                                         var cal_end_D=data[0].cartime_end.substr(8,2)
                                         var cal_end_H=data[0].cartime_end.substr(11,2)
      								    //选择时间
      					 var minDate
	                     if(new Date(cal_start_Y,cal_start_M,cal_start_D,cal_start_H)>new Date()){
	                     	minDate=new Date(cal_start_Y,cal_start_M,cal_start_D,cal_start_H)
	                     }else{
	                     	minDate=new Date()
	                     }
	                     console.log(minDate)
	                      $("#rang-time-start").datetimePicker({});
	                      $("#rang-time-end").datetimePicker({});
//	                     var now=new Date();
//                        $('#rang-time').mobiscroll().range({	
//                        theme: 'mobiscroll',	
//                        display: 'top',
//                        lang:'zh',
//                        showLabel:true,
//                        rows:3,
//                        controls:  ['datetime'],
//                        startInput: '#rang-time-start',
//                        endInput: '#rang-time-end',
//                        minDate: minDate,
//                        defaultValue:[minDate,new Date(now.getFullYear(), now.getMonth(), now.getDate()+2, now.getHours())],
//                        maxDate: new Date(cal_end_Y,cal_end_M,cal_end_D,cal_end_H),
//                        dateFormat: 'yy-mm-dd',
//                        timeFormat: 'HH',
//                        timeWheels: 'H', 
//		                  timeText:'选择时间',
//		                  dateOrder: 'yy M d',
//		                  //setText: '确定', //确认按钮名称
//                        //cancelText: '取消',//取消按钮名籍我
//		                  monthText: '月',
//		                  dayText: '日',
//	                      //yearText:'年',
//		                  hourText:'时',
//		                  stepMinute: 10,
//		                  monthNamesShort:"1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月".split(","),
//		                  dayNamesShort: ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'],
//		                  fromText:'开始时间',
//		                  toText:'结束时间', 
////		                  invalid: [
////                                    { start: '00:00', end: '07:59' }, // Every day
////                                    { start: '21:00', end: '23:59' }, // Every day
//////                                    { d: 'w6', start: '00:00', end: '08:59' }, // Saturday
//////                                    { d: 'w6', start: '17:00', end: '23:59' }, // Saturdayexact date
////                                   ],
////                        minRange:172800000
//		                   
//                        });
      								    
      							 }
      					}
      				});
                    //获取时间范围结束
                     //选择服务地点start
                       $('.for-select-local').click(function(e){
      				        $.popup('.popup');
      			         $('span[name=stu]').trigger('click')
      			        })
      			     var list=my.getStores()
      			     $('.ball-pulse').hide()
	                 $('.get-car-lista span').click(function(){
		             $('.get-car-lista span').removeClass('active')
		             $(this).addClass('active')
		             var name=$(this).attr('name')
		             $('.get-car-listb span').remove()
		             $('.get-car-listb').show()
		             $('.get-car-listc,.get-car-listd,.get-car-other-box,.get-car-other-btn').hide()
		            for( k in list){
		           	if(name.match(list[k].city_spell.substr(0,1))){
				         var html="<span id='"+k+"'>"+list[k].city_name+"</span>"
				       $('.get-car-listb').prepend(html)
		              }
		            }
		            $('.get-car-listb span').click(function(){
		           	      //$('[name=brand_id]').val($(this).attr('id'))
		 	              $('.get-car-listb span').removeClass('active')
		                  $(this).addClass('active')
		                  $('.get-car-listc span').remove()
		                  $('.get-car-listc').show()
		                  $('.get-car-listd span').remove()
		                  $('.get-car-listd').hide()
		                  var j=$(this).attr('id')
		                   for(k in list[j].ji){
				               var html="<span id='"+j+"' name='"+k+"' >"+list[j].ji[k].airport_name+"</span>"
				                   $('.get-car-listc').prepend(html)
		                   }
		                   $('.get-car-listc span').click(function(){
		                   	                    //$('[name=cars_id]').val($(this).attr('name'))
		                   	                     $('.get-car-listc span').removeClass('active')
		                                         $(this).addClass('active')
		                                         $('.get-car-listd span').remove()
		                                         $('.get-car-listd').show()
		                                         var j=$(this).attr('id')
		                                         var w=$(this).attr('name')
		                                         for(k in list[j].ji[w].men){
				                                       var html="<span id='"+k+"'>"+list[j].ji[w].men[k].stores_name+"</span>"
				                                           $('.get-car-listd').prepend(html)
		                                            }
		                                          $('.get-car-listd span').click(function(){
		                                          	$('[name=park_place]').val($(this).attr('id'))
		                                          	$('[name=airport_id]').val($('.get-car-listc span.active').attr('id'))
		                                          	$('[name=city_id]').val($('.get-car-listb span.active').attr('id'))
                	                                $('.for-select-local-text').text($(this).text()).css('color','#0894ec')
                	                                $.closeModal('.popup')
                                                  })
	                    })
	                })
              })
                        //选择服务地点end
                        $('#rang-time').change(function(){
                        	var start_time=$('#rang-time-start').val()+":00";
                        	var end_time=$('#rang-time-end').val()+":00";
                        	var rang_time=start_time+" 到  "+end_time;
                        	$('#rang-time').val(rang_time)
                        })
                        $('.change-search').click(function(){
                       	    $('.carRental-main').show()
                         	$('header').hide()
                       	    $('.carlist').hide()
                        })
                        //提交点击效果
                        var seat
                        $('#carRental-submit').click(function(){
                        	$('#carRental-submit').addClass('active_btn')
                        	$.showPreloader()
                        	sessionStorage.car_place=$('[name=park_place]').val()
                        	sessionStorage.car_place_name=$('.for-select-local-text').text()
                        	sessionStorage.rangTimeStart=$('#rang-time-start').val()
                        	sessionStorage.rangTimeEnd=$('#rang-time-end').val()
	                        var info={
      					           user_id:my.getCookie('id'),
      					           car_place:$('[name=park_place]').val(),
      					           start_time:$('#rang-time-start').val(),
      					           end_time:$('#rang-time-end').val(),
      					           scb:$('[name=scb]').val(),
      					           seat:$('[name=seat]').val(),
      					           city:$('[name=city]').val(),
      					           page:1,
      					           rows:10,
      					           brandid:'',
      					           carsid:'',
      					           
      				        }
	                        console.log(info)
      				        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				        $.ajax({
      					       url:api.selectvehicle,
      					       type: 'post',
      					       async:false,
      					       data:{'api_value':info},
      					       error:function(){
      					       	   $.hidePreloader()
      					       	   $('#carRental-submit').removeClass('active_btn')
      					       	   $.toast("提交失败，请重试！");},
      					       success:function(data){
      					       	   $.hidePreloader()
      						     if(data.match("err_code")!=null){
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg,function(){
      									   	$('#carRental-submit').removeClass('active_btn')
      									   })
      									   
      								}     
      						     }else{
      						     	   $('#carRental-submit').removeClass('active_btn')
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    carListsort=data.car_list
      								    console.log( carListsort)
      								    carListsort.sort(function(x,y){return x.work_day_price-y.work_day_price})
      								    //sessionStorage.rentalCal_list=JSON.stringify(data.car_list)
      								    $('.carRental-main').hide()
      				                    $('header').show()
      				                    $('.carlist').show()
      				                    $('.carR-car-list ul').empty()
      				                     if(data.car_list.length<10){
      	    	                                 $.detachInfiniteScroll($('.infinite-scroll'));
                                                 $('.infinite-scroll-preloader').hide();
                                                 $('.infiniteOver').show()
      	    	                             }else{
      	    	                             	$.attachInfiniteScroll($('.infinite-scroll'));
                                                  $('.infinite-scroll-preloader').show();
                                                  $('.infiniteOver').hide()
      	    	                             }
      	    	                        
      				                    for(i=0;i<data.car_list.length;i++){
      				                    	
      				                    	var usercar_nickname=data.car_list[i].usercar_nickname?data.car_list[i].usercar_nickname.substr(0,2)+'***':'未填写'
      				                    	var speed_changing_box
      				                    	if(data.car_list[i].speed_changing_box==1){
      				                    		speed_changing_box='手动'
      				                    	}else if(data.car_list[i].speed_changing_box==2){
      				                    		speed_changing_box='自动'
      				                    	}
      				                    	switch(+data.car_list[i].seat){
      				                    		case 1:
      				                    		seat="2座";
      				                    		break;
      				                    		case 2:
      				                    		seat="5座";
      				                    		break;
      				                    		case 3:
      				                    		seat="7座";
      				                    		break;
      				                    		case 4:
      				                    		seat="7座以上";
      				                    		break;
      				                    	}
      				                        var list='<li title="'+i+'" id="'+data.car_list[i].usercar_id+'"><div><img style="height: 8rem;max-width: 100%;" src="'+config.url_car+data.car_list[i].models_logo+'"></div><div>'
		                                          +data.car_list[i].brand_chinese_name+'/'+data.car_list[i].models_name+'</div><div><span>'
		                                          +data.car_list[i].work_day_price+' 元起</span><span style="float: right;color: #fff;"></span><div class="clear"></div></div>'
		                                          +'<div class="qcxq">'+usercar_nickname+'/'+data.car_list[i].usercar_color+'/'+speed_changing_box+'/行李箱'
                                                  +data.car_list[i].trunk_capacity+'L/'+seat+'</div></li>'
      				                        $('.carR-car-list ul').append(list)
      				                       
      				                    }
      				                     $('.carR-car-list ul li').click(function(){
      				                    	var id=$(this).attr('title')
      				                    	sessionStorage.rentalCalDetails=JSON.stringify(data.car_list[id])
      				                    	sessionStorage.carDetails_carid=data.car_list[id].usercar_id
      				                    	//$.router.loadPage("carDetails.html");
                                             $.router.load(carDetailsUrl,true);
      				                     })
      				                    
      							}
      					    }
      			         })
      			        })
                        //排序开始
                         $('.RCR-px').click(function(){
                         	if($('.RCR-px span:eq(0)').text()=="价格从低到高"){
                         		$('.RCR-px span:eq(0)').text("价格从高到低")
                         		
                         	}else if($('.RCR-px span:eq(0)').text()=="价格从高到低"){
                         		$('.RCR-px span:eq(0)').text("价格从低到高")
                         		
                         	}
                         	 carListsort.reverse()
                         	 $('.carR-car-list ul').empty()
                         	 for(i=0;i<carListsort.length;i++){
                         	 	            var usercar_nickname=carListsort[i].usercar_nickname.substr(0,2)+'***'
      				                    	var speed_changing_box
      				                    	if(carListsort[i].speed_changing_box==1){
      				                    		speed_changing_box='手动'
      				                    	}else if(carListsort[i].speed_changing_box==2){
      				                    		speed_changing_box='自动'
      				                    	}
      				                    	switch(+carListsort[i].seat){
      				                    		case 1:
      				                    		seat="2座";
      				                    		break;
      				                    		case 2:
      				                    		seat="5座";
      				                    		break;
      				                    		case 3:
      				                    		seat="7座";
      				                    		break;
      				                    		case 4:
      				                    		seat="7座以上";
      				                    		break;
      				                    	}
      				                         var list='<li title="'+i+'" id="'+carListsort[i].usercar_id+'"><div><img style="height:8rem;max-width: 100%;" src="'+config.url_car+carListsort[i].models_logo+'"></div><div>'
		                                          +carListsort[i].brand_chinese_name+'/'+carListsort[i].models_name+'</div><div><span>'
		                                          +carListsort[i].work_day_price+' 元起</span><span style="float: right;color: #fff;"></span><div class="clear"></div></div>'
		                                          +'<div class="qcxq">'+usercar_nickname+'/'+carListsort[i].usercar_color+'/'+speed_changing_box+'/行李箱'
                                                  +carListsort[i].trunk_capacity+'L/'+seat+'</div></li>'
      				                        $('.carR-car-list ul').append(list)
      				                       
      				                    }
      				                     $('.carR-car-list ul li').click(function(){
      				                    	var id=$(this).attr('title')
      				                    	sessionStorage.rentalCalDetails=JSON.stringify(carListsort[id])
      				                    	sessionStorage.carDetails_carid=carListsort[id].usercar_id
      				                    	//$.router.loadPage("carDetails.html");
                                             $.router.load(carDetailsUrl,true);
      				        })
                         })
                        //排序结束
                        //更多选项
                        $('#show-morefree').click(function(){
      				    $('.RC-more').toggle()
      				     if($(this).find('img').attr('src')=='/h5car/img/icon/icon_down.png'){
      				     	$(this).find('img').attr('src','/h5car/img/icon/icon_up.png')
      				     }else{
      				     	$(this).find('img').attr('src','/h5car/img/icon/icon_down.png')
      				     }
      			        })
                        $('.RC-more li').eq(0).click(function(){
                        	$('.RC-more-up-b').show()
                        	$('.RC-more-up').not('.RC-more-up-b').hide()
                        })
                        $('.RC-more-up-b span').click(function(){
                        	$('.RC-more li').eq(0).find('span').eq(1).text($(this).text()).css('color','#0894ec')
                        	$('[name=scb]').val($(this).attr('title'))
                        	$('.RC-more-up').hide()
                        })
                        $('.RC-more li').eq(1).click(function(){
                        	$('.RC-more-up-c').show()
                        	$('.RC-more-up').not('.RC-more-up-c').hide()
                        })
                        $('.RC-more-up-c span').click(function(){
                        	$('.RC-more li').eq(1).find('span').eq(1).text($(this).text()).css('color','#0894ec')
                        	$('[name=seat]').val($(this).attr('title'))
                        	$('.RC-more-up').hide()
                        })
                        $('.RC-more li').eq(2).click(function(){
                        	$('.RC-more-up-d').show()
                        	$('.RC-more-up').not('.RC-more-up-d').hide()
                        })
                        $('.RC-more-up-d span').click(function(){
                        	$('.RC-more li').eq(2).find('span').eq(1).text($(this).text()).css('color','#0894ec')
                        	$('[name=city]').val($(this).attr('title'))
                        	$('.RC-more-up').hide()
                        })
                        //选择车型
                       
                        //下拉刷新start
      		             $(document).on('refresh', '.pull-to-refresh-content-rentalCarList',function() {
	                        var info={
      					           user_id:my.getCookie('id'),
      					           car_place:$('[name=park_place]').val(),
      					           start_time:$('#rang-time-start').val()+":00:00",
      					           end_time:$('#rang-time-end').val()+":00:00",
      					           scb:$('[name=scb]').val(),
      					           seat:$('[name=seat]').val(),
      					           city:$('[name=city]').val(),
      					           page:1,
      					           rows:10,
      					           brandid:'',
      					           carsid:'',
      					           
      				        }
      				        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				        $.ajax({
      					       url:api.selectvehicle,
      					       type: 'post',
      					       async:false,
      					       data:{'api_value':info},
      					       error:function(){
      					       	   $.pullToRefreshDone('.pull-to-refresh-content');
      					       	   $.toast("提交失败，请重试！");},
      					       success:function(data){
      						     if(data.match("err_code")!=null){	
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   $.pullToRefreshDone('.pull-to-refresh-content');
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.pullToRefreshDone('.pull-to-refresh-content');
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						     }else{
      						     	    $.pullToRefreshDone('.pull-to-refresh-content');
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    console.log(data)
                                         if(data.car_list.length<10){
      	    	                                 $.detachInfiniteScroll($('.infinite-scroll'));
                                                 $('.infinite-scroll-preloader').hide();
                                                 $('.infiniteOver').show()
      	    	                             }else{
      	    	                             	$.attachInfiniteScroll($('.infinite-scroll'));
                                                  $('.infinite-scroll-preloader').show();
                                                  $('.infiniteOver').hide()
      	    	                        }
      								    carListsort=data.car_list
      								    carListsort.sort(function(x,y){return x.work_day_price-y.work_day_price})
      								    //sessionStorage.rentalCal_list=JSON.stringify(data.car_list)
      								    $('.carRental-main').hide()
      				                    $('header').show()
      				                    $('.carlist').show()
      				                    $.hideIndicator()
      				                    $('.carR-car-list ul').empty()
      				                    for(i=0;i<data.car_list.length;i++){
      				                    	var usercar_nickname=data.car_list[i].usercar_nickname.substr(0,2)+'***'
      				                    	var speed_changing_box
      				                    	if(data.car_list[i].speed_changing_box==1){
      				                    		speed_changing_box='手动'
      				                    	}else if(data.car_list[i].speed_changing_box==2){
      				                    		speed_changing_box='自动'
      				                    	}
      				                    	switch(+data.car_list[i].seat){
      				                    		case 1:
      				                    		seat="2座";
      				                    		break;
      				                    		case 2:
      				                    		seat="5座";
      				                    		break;
      				                    		case 3:
      				                    		seat="7座";
      				                    		break;
      				                    		case 4:
      				                    		seat="7座以上";
      				                    		break;
      				                    	}
      				                        var list='<li title="'+i+'" id="'+data.car_list[i].usercar_id+'"><div><img style="height:8rem;max-width: 100%;" src="'+config.url_car+data.car_list[i].models_logo+'"></div><div>'
		                                          +data.car_list[i].brand_chinese_name+'/'+data.car_list[i].models_name+'</div><div><span>'
		                                          +data.car_list[i].work_day_price+' 元起</span><span style="float: right;color: #fff;"></span><div class="clear"></div></div>'
		                                          +'<div class="qcxq">'+usercar_nickname+'/'+data.car_list[i].usercar_color+'/'+speed_changing_box+'/行李箱'
                                                  +data.car_list[i].trunk_capacity+'L/'+seat+'</div></li>'
      				                        $('.carR-car-list ul').append(list)
      				                       
      				                    }
      				                     $('.carR-car-list ul li').click(function(){
      				                    	var id=$(this).attr('title')
      				                    	sessionStorage.rentalCalDetails=JSON.stringify(data.car_list[id])
      				                    	sessionStorage.carDetails_carid=data.car_list[id].usercar_id
      				                    	//$.router.loadPage("carDetails.html");
                                             $.router.load(carDetailsUrl,true);
      				                     })
      				                    
      							}
      					    }
      			         })
                });//下拉刷新end
                         //无限加载
      	    	        $(document).on("infinite", ".infinite-scroll-rentalCarList", function() {
                    //   如果正在加载，则退出
                    if (loading) return;
                    pageNow=Math.ceil($('.carR-car-list ul li').length/10+0.01)
                    console.log('pageNow:'+pageNow)
                    loading = true;
                    setTimeout(function() {
                    loading = false;
                    var info={
      					           user_id:my.getCookie('id'),
      					           car_place:$('[name=park_place]').val(),
      					           start_time:$('#rang-time-start').val()+":00:00",
      					           end_time:$('#rang-time-end').val()+":00:00",
      					           scb:$('[name=scb]').val(),
      					           seat:$('[name=seat]').val(),
      					           city:$('[name=city]').val(),
      					           page:pageNow,
      					           rows:10,
      					           brandid:'',
      					           carsid:'',
      					           
      				        }
      				        info=my.cryptoASEencrypt(JSON.stringify(info),key)
      				        $.ajax({
      					       url:api.selectvehicle,
      					       type: 'post',
      					       async:false,
      					       data:{'api_value':info},
      					       error:function(){
      					       	   $.hidePreloader()
      					       	   $('#carRental-submit').removeClass('active_btn')
      					       	   $.toast("提交失败，请重试！");},
      					       success:function(data){
      					       	   $.hidePreloader()
      						     if(data.match("err_code")!=null){
      						     	
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.alert(JSON.parse(data).err_msg,function(){
      									   	  $.detachInfiniteScroll($('.infinite-scroll'));
                                               $('.infinite-scroll-preloader').hide();
                                               $('.infiniteOver').show()
      									   })
      								}     
      						     }else{
      							        data=JSON.parse(data)
      								    data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								    
      								    carListsort=carListsort.concat(data.car_list)
      								   // carListsort=data.car_list
      								    carListsort.sort(function(x,y){return x.work_day_price-y.work_day_price})
      								    
      	    	   	                       if(data.car_list.length!=0){
      	    	   		                       if(pageNow==1){
      	    	   		                               $('.carR-car-list ul').empty()	
      	    	   		                          }
      	    	   		                   for(i=0;i<data.car_list.length;i++){
      				                    	  var usercar_nickname=data.car_list[i].usercar_nickname.substr(0,2)+'***'
      				                    	  var speed_changing_box
      				                    	  if(data.car_list[i].speed_changing_box==1){
      				                    		speed_changing_box='手动'
      				                    	    }else if(data.car_list[i].speed_changing_box==2){
      				                    		speed_changing_box='自动'
      				                    	    }
      				                    	    switch(+data.car_list[i].seat){
      				                    		case 1:
      				                    		seat="2座";
      				                    		break;
      				                    		case 2:
      				                    		seat="5座";
      				                    		break;
      				                    		case 3:
      				                    		seat="7座";
      				                    		break;
      				                    		case 4:
      				                    		seat="7座以上";
      				                    		break;
      				                    	}
      				                            var list='<li title="'+i+'" id="'+data.car_list[i].usercar_id+'"><div><img style="height: 8rem;max-width: 100%;" src="'+config.url_car+data.car_list[i].models_logo+'"></div><div>'
		                                          +data.car_list[i].brand_chinese_name+'/'+data.car_list[i].models_name+'</div><div><span>'
		                                          +data.car_list[i].work_day_price+' 元起</span><span style="float: right;color: #fff;"></span><div class="clear"></div></div>'
		                                          +'<div class="qcxq">'+usercar_nickname+'/'+data.car_list[i].usercar_color+'/'+speed_changing_box+'/行李箱'
                                                  +data.car_list[i].trunk_capacity+'L/'+seat+'</div></li>'
      				                            $('.carR-car-list ul').append(list)
      				                       
      				                       }
      	    	                           if(data.car_list.length<10){
      	    	                                 $.detachInfiniteScroll($('.infinite-scroll'));
                                                 $('.infinite-scroll-preloader').hide();
                                                 $('.infiniteOver').show()
      	    	                             }
      	    	                           $('.carR-car-list ul li').click(function(){
      				                    	    var id=$(this).attr('title')
      				                    	    sessionStorage.rentalCalDetails=JSON.stringify(data.car_list[id])
      				                    	    sessionStorage.carDetails_carid=data.car_list[id].usercar_id
      				                        })
      	    	                           }else{
      	    	     	                       $.detachInfiniteScroll($('.infinite-scroll'));
                                               $('.infinite-scroll-preloader').hide();
                                               $('.infiniteOver').show()
      	    	                            }
                                           
      							}
      					    }
      			         })
      			    }, 2000);
      			
               });
});
////////////////////////////////////////////page_carDetails//////////////////////
$(document).on("pageInit", "#page_carDetails", function(e, pageId, $page) {
	$.showPreloader()
					var key=my.get_key(my.getCookie('token'))
					var cardetails=JSON.parse(sessionStorage.rentalCalDetails)
      				$('<div class="swiper-slide"><img  src="'+config.url_car+cardetails.models_logo+'">').appendTo('.swiper-wrapper')
					$('#cp').text(cardetails.usercar_nickname)
					$('#dd').text(sessionStorage.car_place_name)
					$('#clxh').text(cardetails.brand_chinese_name+' '+cardetails.cars_name)
					$('#qcsj').text(sessionStorage.rangTimeStart+':00')
					$('#hcsj').text(sessionStorage.rangTimeEnd+':00')
					$('#festival_price').text(config.danwei+cardetails.festival_price)
					$('#week_price').text(config.danwei+cardetails.week_price)
					$('#work_day_price').text(config.danwei+cardetails.work_day_price)
					//获取照片
                    var info_carDetail_img={'cars_id':sessionStorage.carDetails_carid}
    					info_carDetail_img=JSON.stringify(info_carDetail_img)
                        info_carDetail_img=my.cryptoASEencrypt(info_carDetail_img,key)
                        $.ajax({
      					url:api.getcarsinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_carDetail_img
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("请求失败，请刷新重试");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						}else{
      								  data=JSON.parse(data)
                                      data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      							      for(i=0;i<data['carimg'].length;i++){
      							    	var src='<div class="swiper-slide"><img id="'+data['carimg'][i].image_id+'" src="'+config.url+data['carimg'][i].image_bigurl+'">'
      							    	$(src).prependTo('.swiper-wrapper')
      							      }
      							    var mySwiper = new Swiper('.swiper-container',{
                                                       pagination : '.swiper-pagination',
                                                       paginationElement : 'li',
                                               })
      							}
      					}
      				});
					$('.carDetails_qrxd').click(function(){
						   $.showPreloader()
	                        var info_cd={
      					           usercar_id:cardetails.usercar_id,
      					           car_place:sessionStorage.car_place,
      					           start_time:sessionStorage.rangTimeStart,
      					           end_time:sessionStorage.rangTimeEnd,
      					           cartime_id:cardetails.cartime_id
      				        }
	                        console.log(info_cd)
      				        info_cd=my.cryptoASEencrypt(JSON.stringify(info_cd),key)
      				        $.ajax({
      					       url:api.dateandrent,
      					       type: 'post',
      					       async:true,
      					       data:{'api_value':info_cd},
      					       error:function(){
      					       	   $.hidePreloader()
      					       	   $.toast("提交失败，请重试！");},
      					       success:function(data){
      					       	$.hidePreloader()
      						     if(data.match("err_code")!=null){	
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						     }else{
      							        data=JSON.parse(data)
      							        sessionStorage.orderDetails=my.cryptoASEdencrypt(data.data,key)
      								    //$.router.loadPage("orderDetails.html");
                                     $.router.load(orderDetailsUrl,true);
      								   
      							}
      					    }
      			         })
					})
});
//////////////////////////page_orderDetails/////////////////////
$(document).on("pageInit", "#page_orderDetails", function(e, pageId, $page) {
                    key=my.get_key(my.getCookie('token'))
					var details=JSON.parse(sessionStorage.orderDetails)
					console.log(details)
					var cardetails=JSON.parse(sessionStorage.rentalCalDetails)
					console.log(cardetails)
					$('.cp').text(cardetails.usercar_nickname)
					$('.dd').text(sessionStorage.car_place_name)
					$('.clxh').text(cardetails.brand_chinese_name+' '+cardetails.cars_name)
					$('.qcsj').text(sessionStorage.rangTimeStart+":00")
					$('.hcsj').text(sessionStorage.rangTimeEnd+":00")
					$('.festival_price').text(config.danwei+cardetails.festival_price)
					$('.week_price').text(config.danwei+cardetails.week_price)
					$('.work_day_price').text(config.danwei+cardetails.work_day_price)
					//获取余额
	                        var info_ye={
	                        	   user_id:my.getCookie('id'),
      				        }
      				        info_ye=my.cryptoASEencrypt(JSON.stringify(info_ye),key)
      				        $.ajax({
      					       url:api.getuserbalancea,
      					       type: 'post',
      					       async:true,
      					       data:{'api_value':info_ye},
      					       error:function(){
      					       	  
      					       	   $.toast("获取失败");},
      					       success:function(data){
      						     if(data.match("err_code")!=null){	
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									  
      									   my.tokenExpire()
      									   break;
      									default:
      									   
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						       }else{
      						     	     data=JSON.parse(data)
      								     data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								     $('.ye').text(config.danwei+data[0].balancea_ccount)
      							}
      					    }
      			         })
      				//获取余额end
					//获取优惠券start
	                        var info_yh={
	                        	   user_id:my.getCookie('id'),
	                        	   cars_id:cardetails.cars_id,
      					           usercar_id:cardetails.usercar_id,
      					           store_id:sessionStorage.car_place,
      					           start_time:sessionStorage.rangTimeStart,
      					           end_time:sessionStorage.rangTimeEnd,
      					           brand_id:cardetails.brand_id
      				        }
	                        console.log(info_yh)
      				        info_yh=my.cryptoASEencrypt(JSON.stringify(info_yh),key)
      				        $.ajax({
      					       url:api.availablecoupons,
      					       type: 'post',
      					       async:true,
      					       data:{'api_value':info_yh},
      					       error:function(){
      					       	   
      					       	   $.toast("优惠券接口调用出错");},
      					       success:function(data){
      						     if(data.match("err_code")!=null){	
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   
      									   my.tokenExpire()
      									   break;
      									default:
      									  
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						        }else{
      						        	
      						     	     data=JSON.parse(data)
      								     data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								     console.log(data)
      								     for(i=0;i<data.length;i++){
      								     	 var option_str='<option title="'+data[i].coupon_value+'" value="'+data[i].coupon_used_id+'">'+data[i].coupon_name+'('+data[i].coupon_value+')</option>'
      								         $('.yhq_s').append(option_str)
      								     }
      								      $('.yhq_s').change(function(){
      								     	$('.yhq div span:first').text(config.danwei+$('.yhq_s option:checked').attr('title'))
      								     })
      							}
      					    }
      			         })
      				//获取优惠券end
      				//获取保险套餐start
      				 var info_baoxian={
	                        	   user_id:my.getCookie('id'),
      				        }
      				        info_baoxian=my.cryptoASEencrypt(JSON.stringify(info_baoxian),key)
      				        $.ajax({
      					       url:api.insurancelist,
      					       type: 'post',
      					       async:true,
      					       data:{'api_value':info_baoxian},
      					       error:function(){
      					       	  
      					       	   $.toast("保险接口调用出错");},
      					       success:function(data){
      						     if(data.match("err_code")!=null){	
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   
      									   my.tokenExpire()
      									   break;
      									default:
      									   
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						     }else{
      						     	     data=JSON.parse(data)
      								     data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								     for(i=0;i<data.length;i++){
      								     	 var option_str='<option title="'+data[i].insurance_combo_price+'" value="'+data[i].insurance_combo_id+'">'+data[i].insurance_combo_name+'('+config.danwei+data[i].insurance_combo_price+')'+'</option>'
      								         $('.bxtc_s').append(option_str)
      								     }
      								     var price=[]
      								     for(var i=0;i<$('.bxtc_s option').length;i++){
      								     	 price[i]=$('.bxtc_s option').eq(i).attr('title')
      								     }
      								     price=price.sort( function sortNumber(a,b)
                                            {
                                           return a - b
                                             }).pop()
                                         $('.bxtc div span:first-child').text(config.danwei+price)
                                         price='[title="'+price+'"]'
                                         $(price).attr('selected',true)
      								     $('.bxtc_s').change(function(){
      								     	$('.bxtc div span:first').text(config.danwei+$('.bxtc_s option:checked').attr('title'))
      								     })
      							}
      					    }
      			         })
      				//获取保险套餐end
      				//提交订单start
      				$('.orderDetails-submit').click(function(){
      					$.showPreloader()
      					$('.orderDetails-submit').addClass('active_btn')
      					var info_submit={
      						       user_id:my.getCookie('id'),
	                        	   order_daterent:details,
	                        	   order_baoxian:$('.bxtc_s option:checked').attr('title'),
	                        	   order_baoxianid:$('.bxtc_s').val(),
	                        	   order_youhui:$('.yhq_s option:checked').attr('title'),
	                        	   order_youhuiid:$('.yhq_s').val(),
      				      }
      					console.log(info_submit)
      				        info_submit=my.cryptoASEencrypt(JSON.stringify(info_submit),key)
      				        $.ajax({
      					       url:api.bookingorder,
      					       type: 'post',
      					       async:false,
      					       data:{'api_value':info_submit},
      					       error:function(){
      					       	   $.hidePreloader()
      					       	   $('.orderDetails-submit').removeClass('active_btn')
      					       	   $.toast("提交失败，请重试！");},
      					       success:function(data){
      					           $('.orderDetails-submit').removeClass('active_btn')
      						     if(data.match("err_code")!=null){	
      						     	$('.orderDetails-submit').removeClass('active_btn')
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   $.hidePreloader()
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.hidePreloader()
      									   $.toast(JSON.parse(data).err_msg);
      								}     
      						     }else{
      						     	     $.hidePreloader()
      						     	     data=JSON.parse(data)
      								     data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      								     console.log(data)
                                         sessionStorage.waitfp_id=data.waitfp_id
      					                 sessionStorage.rental_orderid=data.rental_orderid
      					                 sessionStorage.orderid=data.rental_orderid
      					                // $.router.loadPage("zhifu_other.html");
                                     $.router.load(zhifu_otherUrl,true);
      							}
      					    }
      			         })
      				})
      				//提交订单end
      				//支付操作start
      				$('.get-car-hold').click(function(){
      				    $('.get-cash').hide();
      					$(this).hide()
      					//$.router.loadPage("rentalCarOrderDetails.html");
                        $.router.load(rentalCarOrderDetailsUrl,true);
      				})
      				$('.get-cash-e span:first-child').click(function(){
      					 $('.get-cash').hide();
      					 $('.get-car-hold').hide()
      					// $.router.loadPage("rentalCarOrderDetails.html");
                        $.router.load(rentalCarOrderDetailsUrl,true);
      				})
});
///////////////////////////////page_mycarlist//////////////////////////
$(document).on("pageInit", "#page_mycarlist1", function(e, pageId, $page) {
    if(my.getCookie('token')!=false&&my.getCookie('id')!=false){
        $.router.loadPage('#page_mycarlist2');
    }
     var showOwnerSwiper = new Swiper('.swiper-container',{
                                                       pagination : '.swiper-pagination',
                                                       paginationElement : 'li',
                                                })
    //添加车辆
    
});
$(document).on("pageInit", "#page_mycarlist2", function(e, pageId, $page) {
	 $.showPreloader();
	  var showOwnerSwiper = new Swiper('.swiper-container',{
                                                       pagination : '.swiper-pagination',
                                                       paginationElement : 'li',
                                                })
	 $('.css_car_add').click(function(){
        $.router.loadPage(' checkCar.html');
    });
    var key=my.get_key(my.getCookie('token'));
    var info_carManger={
        'u_userid':my.getCookie('id')
    };
    info_carManger=JSON.stringify(info_carManger);
    info_carManger=my.cryptoASEencrypt(info_carManger,key);
    $.ajax({
        type:"post",
        url:api.usercarlist,
        data:{
            'api_value':info_carManger
        },
        error:function(){
            $.hidePreloader();
            $.toast("请求失败，请刷新重试");
        },
        success:function(data){

            $.hidePreloader();
            if(data.match("err_code")!=null){
                switch(JSON.parse(data).err_code)
                {
                    case 40003:
                        my.tokenExpire();
                        break;
                    default:
                        $.toast(JSON.parse(data).err_msg);

                }

            }
            else{
                data=JSON.parse(data);
                data=JSON.parse(my.cryptoASEdencrypt(data.data,key));
                console.log(data);
                //循环输出车辆
                $('.script_car_list').empty();
                for(i=0;i<data.length;i++){
                    var none='display:none;';
                    var none_in='display:none';
                    var none_edit='display:none';
                    var state_doc='...正在认证';
                    if(data[i].auditresult_state==1){
                        none='display:block;';
                        none_in='display:inline-block;';
                        state_doc='认证通过'
                    }
                    if(data[i].auditresult_state==2){
                        none_edit='display:block';
                        state_doc='认证失败：'+data[i].resultreason;
                    }
                   // var list='<li name="'+ data[i].usercar_id +'"><div class="car-edit"><div class="carManger-list-top"><div><span><img src="/h5car/img/icon/qcc.png" ></span><p class="brand_chinese_name">'
                     //   + data[i].brand_chinese_name +'</p><div class="clear"></div></div><div class="car_plate">'
                       // + data[i].car_plate +'</div><div class="auditresult_state"><img src="/h5car/img/icon/ok.png" style="width:15px;margin: 0 5px -2px 0;'+ none_in +'">'
                       // + state_doc +'</div></div></div><div class="carManger-list-btn" style="'+ none +'"><div><a href="carRental.html" class="external"><img src="/h5car/img/icon/rll.png">出租</a></div><div class="clear"></div></div><div class="carManger-list-btn carManger-list-btn-edit" style="'+ none_edit +'"><div class="r-check"><img src="/h5car/img/icon/bj.png">重新认证</div><div class="clear"></div></div></li>'
                   var list = '<div class="card"><div class="card-header"><span>'+ data[i].car_plate +'</span><span class="css_car_upd script_car_edit" data-ids="'+ data[i].usercar_id +'">修改</span>'
                               + '<img src="/h5car/img/icon/ok.png" style="width:15px;margin: 0 5px -2px 0;'+ none_in +'"><span class="css_auditsttus"> '+ state_doc +'</span> <span class="css_car_status">停泊中</span> </div> <div style="clear: both;"></div>'
                               +'<div class="card-content"> <div class="card-content-inner" style="height: 3.5rem"> <div class="css_detail_1"> <div>违章</div>'
                               + '<div class="css_center_text">1</div> </div> <div class="css_detail"> <div>罚款(元)</div> <div class="css_center_text">200</div> </div>'
                               +'<div  class="css_detail"> <div>扣分</div> <div class="css_center_text">6</div> </div> <div  class="css_detail"> <div>下次年检</div>'
                               +'<div class="css_center_text">2016-7-8</div> </div> <div  class="css_detail"> <div>下次保养</div> <div class="css_center_text">2015-10-11</div>'
                               +'</div> </div> </div> <div class="card-footer">'
                               +'<span class="css_car_f"><a href='+parkIndexUrl+'  style="color: #ffffff">预约机场停泊</a></span> <span class="css_car_f"><a href='+carRentalUrl+'  style="color: #ffffff">分享赚取收益</a></span> </div> </div>';
                    $('.script_car_list').append(list);
                }
            }
            //汽车编辑
            $('.script_car_edit').click(function(){
                sessionStorage.car_id=$(this).attr('data-ids')
                $.router.load(carEditUrl,true);
            })


            $('.script_caidan').on('click', function () {
                var buttons1 = [
                    {
                        text: '代缴罚款'
                    },
                    {
                        text: '代办驾照'
                    }
                ];
                var buttons2 = [
                    {
                        text: '取消',
                        bg: 'danger'
                    }
                ];
                var groups = [buttons1, buttons2];
                $.actions(groups);
            });
        }
    });
})
///////////////////////////////////////////////////end/////////////////////////////////////////